From 345fc11da9dcad5faa23f9888c8f3a0260e8ad45 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 22 May 2008 20:38:03 +0000 Subject: 2008-05-22 Joel Sherrill * itron/include/rtems/itron/task.h, itron/src/del_tsk.c, itron/src/exd_tsk.c, itron/src/task.c, posix/include/rtems/posix/threadsup.h, posix/src/cancel.c, posix/src/cancelrun.c, posix/src/pthread.c, posix/src/pthreadexit.c, posix/src/setcancelstate.c, posix/src/setcanceltype.c, posix/src/testcancel.c, rtems/src/taskdelete.c, score/inline/rtems/score/object.inl, score/src/objectclose.c, score/src/threadclose.c: Make all task delete/exit/cancel routines follow the same critical section pattern. Also ensure that POSIX cancelation routines are run at thread exit. --- cpukit/posix/src/cancel.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'cpukit/posix/src/cancel.c') diff --git a/cpukit/posix/src/cancel.c b/cpukit/posix/src/cancel.c index a10dd86735..9a3b18481a 100644 --- a/cpukit/posix/src/cancel.c +++ b/cpukit/posix/src/cancel.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -34,9 +34,10 @@ int pthread_cancel( pthread_t thread ) { - Thread_Control *the_thread; - POSIX_API_Control *thread_support; - Objects_Locations location; + Thread_Control *the_thread; + POSIX_API_Control *thread_support; + Objects_Locations location; + boolean cancel = FALSE; /* * Don't even think about deleting a resource from an ISR. @@ -54,11 +55,12 @@ int pthread_cancel( thread_support->cancelation_requested = 1; if (thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE && - thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS) { - _POSIX_Threads_cancel_run( the_thread ); - } + thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS) + cancel = TRUE; _Thread_Enable_dispatch(); + if ( cancel ) + _POSIX_Thread_Exit( the_thread, PTHREAD_CANCELED ); return 0; #if defined(RTEMS_MULTIPROCESSING) -- cgit v1.2.3