diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-18 16:00:54 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-22 16:56:59 +0200 |
commit | 33a4a56e7f2c52148bfd09cdcb7371d9b1b37eb5 (patch) | |
tree | 63951d498925df25b7d2dbd93a95e1645c6fab2c /cpukit/posix/src/mqueuerecvsupp.c | |
parent | score: Create message queue implementation header (diff) | |
download | rtems-33a4a56e7f2c52148bfd09cdcb7371d9b1b37eb5.tar.bz2 |
score: Avoid direct usage of _Thread_Executing
Pass the executing thread as a function parameter. Obtain the executing
thread inside a thread dispatch critical section to avoid problems on
SMP.
Diffstat (limited to 'cpukit/posix/src/mqueuerecvsupp.c')
-rw-r--r-- | cpukit/posix/src/mqueuerecvsupp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cpukit/posix/src/mqueuerecvsupp.c b/cpukit/posix/src/mqueuerecvsupp.c index 5eb856a309..04a75a94cc 100644 --- a/cpukit/posix/src/mqueuerecvsupp.c +++ b/cpukit/posix/src/mqueuerecvsupp.c @@ -53,6 +53,7 @@ ssize_t _POSIX_Message_queue_Receive_support( Objects_Locations location; size_t length_out; bool do_wait; + Thread_Control *executing; the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location ); switch ( location ) { @@ -88,8 +89,10 @@ ssize_t _POSIX_Message_queue_Receive_support( /* * Now perform the actual message receive */ + executing = _Thread_Executing; _CORE_message_queue_Seize( &the_mq->Message_queue, + executing, mqdes, msg_ptr, &length_out, @@ -100,16 +103,16 @@ ssize_t _POSIX_Message_queue_Receive_support( _Objects_Put( &the_mq_fd->Object ); if (msg_prio) { *msg_prio = _POSIX_Message_queue_Priority_from_core( - _Thread_Executing->Wait.count + executing->Wait.count ); } - if ( !_Thread_Executing->Wait.return_code ) + if ( !executing->Wait.return_code ) return length_out; rtems_set_errno_and_return_minus_one( _POSIX_Message_queue_Translate_core_message_queue_return_code( - _Thread_Executing->Wait.return_code + executing->Wait.return_code ) ); |