summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/setcanceltype.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-21 13:17:59 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-21 13:17:59 +0000
commit68799a2a8f7f3d44adfcb57a5e3d00e7448ee4b9 (patch)
tree8c2aef7e06e4e629fc01f016c6cd1e9dc8165167 /cpukit/posix/src/setcanceltype.c
parentUpdate for MPC55XX changes (diff)
downloadrtems-68799a2a8f7f3d44adfcb57a5e3d00e7448ee4b9.tar.bz2
2009-07-21 Santosh G Vattam <vattam.santosh@gmail.com>
* posix/Makefile.am, posix/include/rtems/posix/cancel.h, posix/src/cancel.c, posix/src/setcancelstate.c, posix/src/setcanceltype.c: Add _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch method to avoid duplication of code and ease coverage analysis. * posix/src/canceleval.c: New file.
Diffstat (limited to 'cpukit/posix/src/setcanceltype.c')
-rw-r--r--cpukit/posix/src/setcanceltype.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/cpukit/posix/src/setcanceltype.c b/cpukit/posix/src/setcanceltype.c
index 403e16b812..628bc38dbc 100644
--- a/cpukit/posix/src/setcanceltype.c
+++ b/cpukit/posix/src/setcanceltype.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2008.
+ * COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -20,13 +20,11 @@
#include <rtems/score/chain.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
-#include <rtems/score/wkspace.h>
#include <rtems/posix/cancel.h>
#include <rtems/posix/pthread.h>
#include <rtems/posix/threadsup.h>
-/*PAGE
- *
+/*
* 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
*/
@@ -36,7 +34,6 @@ int pthread_setcanceltype(
)
{
POSIX_API_Control *thread_support;
- bool cancel = false;
/*
* Don't even think about deleting a resource from an ISR.
@@ -59,13 +56,10 @@ int pthread_setcanceltype(
*oldtype = thread_support->cancelability_type;
thread_support->cancelability_type = type;
- if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
- thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
- thread_support->cancelation_requested )
- cancel = true;
- _Thread_Enable_dispatch();
- if ( cancel )
- _POSIX_Thread_Exit( _Thread_Executing, PTHREAD_CANCELED );
-
+ _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( thread_support );
+
+ /*
+ * _Thread_Enable_dispatch is invoked by above call.
+ */
return 0;
}