Changeset a61f1a46 in rtems


Ignore:
Timestamp:
08/06/96 16:24:41 (27 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
0f99198
Parents:
06883e13
Message:

_POSIX_Threads_Delete_extension: reorder to eliminate use of local pointer
variable before set.

pthread_join: using local variable so user can pass NULL pointer as argument

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/posix/src/pthread.c

    r06883e13 ra61f1a46  
    173173  void              **value_ptr;
    174174
    175   (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_POSIX ] );
    176  
    177   deleted->API_Extensions[ THREAD_API_POSIX ] = NULL;
    178 
     175  api = deleted->API_Extensions[ THREAD_API_POSIX ];
     176 
    179177  /* XXX run cancellation handlers */
    180178
     
    184182   *  Wakeup all the tasks which joined with this one
    185183   */
    186  
    187   api = deleted->API_Extensions[ THREAD_API_POSIX ];
    188184 
    189185  value_ptr = (void **) deleted->Wait.return_argument;
     
    194190  if ( api->schedpolicy == SCHED_SPORADIC )
    195191    (void) _Watchdog_Remove( &api->Sporadic_timer );
     192
     193  deleted->API_Extensions[ THREAD_API_POSIX ] = NULL;
     194
     195  (void) _Workspace_Free( api );
    196196}
    197197
     
    10181018  POSIX_API_Control       *api;
    10191019  Objects_Locations        location;
     1020  void                    *return_pointer;
    10201021
    10211022  the_thread = _POSIX_Threads_Get( thread, &location );
     
    10411042       */
    10421043
    1043       _Thread_Executing->Wait.return_argument = (unsigned32 *) value_ptr;
     1044      _Thread_Executing->Wait.return_argument = (unsigned32 *) &return_pointer;
    10441045
    10451046      _Thread_queue_Enter_critical_section( &api->Join_List );
     
    10491050      _Thread_Enable_dispatch();
    10501051
     1052      if ( value_ptr )
     1053        *value_ptr = return_pointer;
    10511054      return 0;
    10521055  }
  • cpukit/posix/src/pthread.c

    r06883e13 ra61f1a46  
    173173  void              **value_ptr;
    174174
    175   (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_POSIX ] );
    176  
    177   deleted->API_Extensions[ THREAD_API_POSIX ] = NULL;
    178 
     175  api = deleted->API_Extensions[ THREAD_API_POSIX ];
     176 
    179177  /* XXX run cancellation handlers */
    180178
     
    184182   *  Wakeup all the tasks which joined with this one
    185183   */
    186  
    187   api = deleted->API_Extensions[ THREAD_API_POSIX ];
    188184 
    189185  value_ptr = (void **) deleted->Wait.return_argument;
     
    194190  if ( api->schedpolicy == SCHED_SPORADIC )
    195191    (void) _Watchdog_Remove( &api->Sporadic_timer );
     192
     193  deleted->API_Extensions[ THREAD_API_POSIX ] = NULL;
     194
     195  (void) _Workspace_Free( api );
    196196}
    197197
     
    10181018  POSIX_API_Control       *api;
    10191019  Objects_Locations        location;
     1020  void                    *return_pointer;
    10201021
    10211022  the_thread = _POSIX_Threads_Get( thread, &location );
     
    10411042       */
    10421043
    1043       _Thread_Executing->Wait.return_argument = (unsigned32 *) value_ptr;
     1044      _Thread_Executing->Wait.return_argument = (unsigned32 *) &return_pointer;
    10441045
    10451046      _Thread_queue_Enter_critical_section( &api->Join_List );
     
    10491050      _Thread_Enable_dispatch();
    10501051
     1052      if ( value_ptr )
     1053        *value_ptr = return_pointer;
    10511054      return 0;
    10521055  }
Note: See TracChangeset for help on using the changeset viewer.