diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-09-30 08:03:39 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-09-30 08:03:39 -0600 |
commit | 987701852b3069e2dc33380fb7816387189eed8e (patch) | |
tree | d18b071dd19b0e608a695585a98934e142b224aa /nuttx/fs | |
parent | bf73e20c239ef3ec7f76217913cb3b97114db7a3 (diff) | |
download | px4-nuttx-987701852b3069e2dc33380fb7816387189eed8e.tar.gz px4-nuttx-987701852b3069e2dc33380fb7816387189eed8e.tar.bz2 px4-nuttx-987701852b3069e2dc33380fb7816387189eed8e.zip |
Repartition some message queue logic: sched/mqueue should have all mqueue knowledge; fs/mqueue should deal only with inodes
Diffstat (limited to 'nuttx/fs')
-rw-r--r-- | nuttx/fs/mqueue/mq_close.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/nuttx/fs/mqueue/mq_close.c b/nuttx/fs/mqueue/mq_close.c index e1c8c1438..f5548345c 100644 --- a/nuttx/fs/mqueue/mq_close.c +++ b/nuttx/fs/mqueue/mq_close.c @@ -44,7 +44,6 @@ #include <assert.h> #include <nuttx/kmalloc.h> -#include <nuttx/sched.h> #include <nuttx/mqueue.h> #include "inode/inode.h" @@ -79,7 +78,7 @@ * * Description: * This function is used to indicate that the calling task is finished - * with the specified message queued mqdes. The mq_close() deallocates + * with the specified message queue mqdes. The mq_close() deallocates * any system resources allocated by the system for use by this task for * its message queue. * @@ -104,8 +103,6 @@ int mq_close(mqd_t mqdes) { - FAR struct tcb_s *rtcb = sched_self(); - FAR struct task_group_s *group = rtcb->group; FAR struct mqueue_inode_s *msgq; FAR struct inode *inode; @@ -117,37 +114,21 @@ int mq_close(mqd_t mqdes) { sched_lock(); - /* Remove the message descriptor from the current task's - * list of message descriptors. - */ - - sq_rem((FAR sq_entry_t*)mqdes, &group->tg_msgdesq); - /* Find the message queue associated with the message descriptor */ msgq = mqdes->msgq; DEBUGASSERT(msgq && msgq->inode); - /* Check if the calling task has a notification attached to - * the message queue via this mqdes. - */ + /* Close/free the message descriptor */ -#ifndef CONFIG_DISABLE_SIGNALS - if (msgq->ntmqdes == mqdes) - { - msgq->ntpid = INVALID_PROCESS_ID; - msgq->ntsigno = 0; - msgq->ntvalue.sival_int = 0; - msgq->ntmqdes = NULL; - } -#endif + mq_desclose(mqdes); /* Get the inode from the message queue structure */ inode = msgq->inode; DEBUGASSERT(inode->u.i_mqueue == msgq); - /* Decrement the reference count on the inode */ + /* Decrement the reference count on the inode, possibly freeing it */ mq_inode_release(inode); sched_unlock(); |