diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-26 21:20:31 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-02 07:46:15 +0200 |
commit | c8982e5f6a4857444676165deab1e08dc91a6847 (patch) | |
tree | 9862d54650522b55afac8a4e1b84ab078a69dff5 /cpukit/posix/src/mqueueunlink.c | |
parent | rtems: Avoid Giant lock for message queues (diff) | |
download | rtems-c8982e5f6a4857444676165deab1e08dc91a6847.tar.bz2 |
posix: Simplify message queues
The mq_open() function returns a descriptor to a POSIX message queue
object identified by a name. This is similar to sem_open(). In
contrast to the POSIX semaphore the POSIX message queues use a separate
object for the descriptor. This extra object is superfluous, since the
object identifier can be used directly for this purpose, just like for
the semaphores.
Update #2702.
Update #2555.
Diffstat (limited to 'cpukit/posix/src/mqueueunlink.c')
-rw-r--r-- | cpukit/posix/src/mqueueunlink.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cpukit/posix/src/mqueueunlink.c b/cpukit/posix/src/mqueueunlink.c index d5182d21fc..dc485ba657 100644 --- a/cpukit/posix/src/mqueueunlink.c +++ b/cpukit/posix/src/mqueueunlink.c @@ -18,10 +18,7 @@ #include "config.h" #endif -#include <mqueue.h> - #include <rtems/posix/mqueueimpl.h> -#include <rtems/seterr.h> /* * 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276 @@ -33,6 +30,7 @@ int mq_unlink( { POSIX_Message_queue_Control *the_mq; Objects_Get_by_name_error error; + ISR_lock_Context lock_context; _Objects_Allocator_lock(); @@ -42,9 +40,12 @@ int mq_unlink( rtems_set_errno_and_return_minus_one( _POSIX_Get_by_name_error( error ) ); } - the_mq->linked = false; _POSIX_Message_queue_Namespace_remove( the_mq ); - _POSIX_Message_queue_Delete( the_mq ); + + _CORE_message_queue_Acquire( &the_mq->Message_queue, &lock_context ); + + the_mq->linked = false; + _POSIX_Message_queue_Delete( the_mq, &lock_context ); _Objects_Allocator_unlock(); return 0; |