summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/canceleval.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/canceleval.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/canceleval.c')
-rw-r--r--cpukit/posix/src/canceleval.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/cpukit/posix/src/canceleval.c b/cpukit/posix/src/canceleval.c
new file mode 100644
index 0000000000..72932da07f
--- /dev/null
+++ b/cpukit/posix/src/canceleval.c
@@ -0,0 +1,37 @@
+/*
+ * COPYRIGHT (c) 1989-2009.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <pthread.h>
+#include <rtems/system.h>
+#include <rtems/score/thread.h>
+#include <rtems/posix/cancel.h>
+#include <rtems/posix/pthread.h>
+
+void _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch(
+ POSIX_API_Control *thread_support
+)
+{
+ bool cancel = false;
+
+ 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 );
+}