[rtems commit] posix: Obtain _Thread_Executing in proper context

Sebastian Huber sebh at rtems.org
Mon Jul 22 14:51:44 UTC 2013


Module:    rtems
Branch:    master
Commit:    768c5cee1895f81823c6505e5b18d0eee5470fec
Changeset: http://git.rtems.org/rtems/commit/?id=768c5cee1895f81823c6505e5b18d0eee5470fec

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jul 19 17:18:15 2013 +0200

posix: Obtain _Thread_Executing in proper context

---

 cpukit/posix/src/pthreadjoin.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/cpukit/posix/src/pthreadjoin.c b/cpukit/posix/src/pthreadjoin.c
index 0ee700a..9dc1b24 100644
--- a/cpukit/posix/src/pthreadjoin.c
+++ b/cpukit/posix/src/pthreadjoin.c
@@ -37,6 +37,7 @@ int pthread_join(
   POSIX_API_Control       *api;
   Objects_Locations        location;
   void                    *return_pointer;
+  Thread_Control          *executing;
 
 on_EINTR:
   the_thread = _Thread_Get( thread, &location );
@@ -50,7 +51,9 @@ on_EINTR:
         return EINVAL;
       }
 
-      if ( _Thread_Is_executing( the_thread ) ) {
+      executing = _Thread_Executing;
+
+      if ( executing == the_thread ) {
         _Objects_Put( &the_thread->Object );
         return EDEADLK;
       }
@@ -67,13 +70,13 @@ on_EINTR:
            (STATES_WAITING_FOR_JOIN_AT_EXIT | STATES_TRANSIENT)
          );
       } else {
-	_Thread_Executing->Wait.return_argument = &return_pointer;
+        executing->Wait.return_argument = &return_pointer;
         _Thread_queue_Enter_critical_section( &api->Join_List );
         _Thread_queue_Enqueue( &api->Join_List, WATCHDOG_NO_TIMEOUT );
       }
       _Objects_Put( &the_thread->Object );
 
-      if ( _Thread_Executing->Wait.return_code == EINTR )
+      if ( executing->Wait.return_code == EINTR )
         goto on_EINTR;
 
       if ( value_ptr )




More information about the vc mailing list