From 33a4a56e7f2c52148bfd09cdcb7371d9b1b37eb5 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 18 Jul 2013 16:00:54 +0200 Subject: 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. --- cpukit/posix/src/mqueuerecvsupp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cpukit/posix/src/mqueuerecvsupp.c') 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 ) ); -- cgit v1.2.3