summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/cancel.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-07-05 18:13:18 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-07-05 18:13:18 +0000
commitf845e96e7beef7d6db35c80e0075dcb07a71dce3 (patch)
tree20e8b5d161afe8cff844b85b0b45611f8611f9c7 /cpukit/posix/src/cancel.c
parent2002-07-05 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-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/cancel.c')
-rw-r--r--cpukit/posix/src/cancel.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/cpukit/posix/src/cancel.c b/cpukit/posix/src/cancel.c
index 88012040fb..f1310d5ab1 100644
--- a/cpukit/posix/src/cancel.c
+++ b/cpukit/posix/src/cancel.c
@@ -31,6 +31,13 @@ int pthread_cancel(
POSIX_API_Control *thread_support;
Objects_Locations location;
+ /*
+ * Don't even think about deleting a resource from an ISR.
+ */
+
+ if ( _ISR_Is_in_progress() )
+ return EPROTO;
+
the_thread = _POSIX_Threads_Get( thread, &location );
switch ( location ) {
case OBJECTS_ERROR:
@@ -42,6 +49,11 @@ 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_Enable_dispatch();
return 0;
}