diff options
Diffstat (limited to 'c/src/exec')
-rw-r--r-- | c/src/exec/posix/src/pthread.c | 6 | ||||
-rw-r--r-- | c/src/exec/rtems/src/tasks.c | 11 |
2 files changed, 15 insertions, 2 deletions
diff --git a/c/src/exec/posix/src/pthread.c b/c/src/exec/posix/src/pthread.c index 3721832c43..f8c6116dd0 100644 --- a/c/src/exec/posix/src/pthread.c +++ b/c/src/exec/posix/src/pthread.c @@ -1144,11 +1144,15 @@ void pthread_exit( void *value_ptr ) { + Objects_Information *the_information; + + the_information = _Objects_Get_information( _Thread_Executing->Object.id ); + _Thread_Disable_dispatch(); _Thread_Executing->Wait.return_argument = (unsigned32 *)value_ptr; - _Thread_Close( &_POSIX_Threads_Information, _Thread_Executing ); + _Thread_Close( the_information, _Thread_Executing ); _POSIX_Threads_Free( _Thread_Executing ); diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c index 3d76782ce1..81955cd305 100644 --- a/c/src/exec/rtems/src/tasks.c +++ b/c/src/exec/rtems/src/tasks.c @@ -555,6 +555,7 @@ rtems_status_code rtems_task_delete( { register Thread_Control *the_thread; Objects_Locations location; + Objects_Information *the_information; the_thread = _Thread_Get( id, &location ); switch ( location ) { @@ -564,7 +565,15 @@ rtems_status_code rtems_task_delete( _Thread_Dispatch(); return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; case OBJECTS_LOCAL: - _Thread_Close( &_RTEMS_tasks_Information, the_thread ); + the_information = _Objects_Get_information( the_thread->Object.id ); + + if ( !the_information ) { + _Thread_Enable_dispatch(); + return RTEMS_INVALID_ID; + /* This should never happen if _Thread_Get() works right */ + } + + _Thread_Close( the_information, the_thread ); _RTEMS_tasks_Free( the_thread ); |