diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-07-05 18:13:18 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-07-05 18:13:18 +0000 |
commit | f845e96e7beef7d6db35c80e0075dcb07a71dce3 (patch) | |
tree | 20e8b5d161afe8cff844b85b0b45611f8611f9c7 /cpukit/posix/src/cancelrun.c | |
parent | 2002-07-05 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-f845e96e7beef7d6db35c80e0075dcb07a71dce3.tar.bz2 |
2002-07-05 Joel Sherrill <joel@OARcorp.com>
* include/rtems/posix/cancel.h, src/cancel.c, src/cancelrun.c,
src/mqueue.c, src/pthread.c, src/semaphore.c, src/setcancelstate.c,
src/setcanceltype.c, src/testcancel.c: Per PR164, corrected the
behavior of thread cancellation and did some cleanup as a side-effect.
Diffstat (limited to 'cpukit/posix/src/cancelrun.c')
-rw-r--r-- | cpukit/posix/src/cancelrun.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/cpukit/posix/src/cancelrun.c b/cpukit/posix/src/cancelrun.c index 1a120ba504..4806e6d378 100644 --- a/cpukit/posix/src/cancelrun.c +++ b/cpukit/posix/src/cancelrun.c @@ -20,15 +20,19 @@ /*PAGE * - * _POSIX_Thread_cancel_run + * _POSIX_Threads_cancel_run * */ -void _POSIX_Thread_cancel_run( +#if !defined(PTHREAD_CANCELED) +#warning "PTHREAD_CANCELED NOT DEFINED -- patch newlib" +#define PTHREAD_CANCELED ((void *) -1) +#endif + +void _POSIX_Threads_cancel_run( Thread_Control *the_thread ) { - int old_cancel_state; POSIX_Cancel_Handler_control *handler; Chain_Control *handler_stack; POSIX_API_Control *thread_support; @@ -38,8 +42,6 @@ void _POSIX_Thread_cancel_run( handler_stack = &thread_support->Cancellation_Handlers; - old_cancel_state = thread_support->cancelability_state; - thread_support->cancelability_state = PTHREAD_CANCEL_DISABLE; while ( !_Chain_Is_empty( handler_stack ) ) { @@ -53,7 +55,13 @@ void _POSIX_Thread_cancel_run( _Workspace_Free( handler ); } - thread_support->cancelation_requested = 0; + /* Now we can delete the thread */ + + the_thread->Wait.return_argument = (unsigned32 *)PTHREAD_CANCELED; + _Thread_Close( + _Objects_Get_information( the_thread->Object.id ), + the_thread + ); + _POSIX_Threads_Free( the_thread ); - thread_support->cancelability_state = old_cancel_state; } |