summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/pthread.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-12-02 08:33:35 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-12-02 09:24:51 +0100
commit927a0a1f990c19a3e7295bb001896b3f3c75a77e (patch)
treeb4c1cdb1a406b700a17b80e235613c9ced8c0cd9 /cpukit/posix/src/pthread.c
parentpstmtests_plan.csv: Update to reflect psxtmcond 09 and 10 exit (diff)
downloadrtems-927a0a1f990c19a3e7295bb001896b3f3c75a77e.tar.bz2
posix: Use cleanup contexts on the stack
Provide support for latest Newlib <pthread.h> change. The cleanup contexts are stored on the thread stack. This is conformant with the POSIX requirements for the pthread_cleanup_push() and pthread_cleanup_pop() statement pair. Passing an invalid pointer as the routine to pthread_cleanup_push() is now a usage error and the behaviour is undefined.
Diffstat (limited to 'cpukit/posix/src/pthread.c')
-rw-r--r--cpukit/posix/src/pthread.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 408bb07dc4..4d8f95f150 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -200,7 +200,11 @@ static bool _POSIX_Threads_Create_extension(
api->cancelation_requested = 0;
api->cancelability_state = PTHREAD_CANCEL_ENABLE;
api->cancelability_type = PTHREAD_CANCEL_DEFERRED;
+#ifndef HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT
_Chain_Initialize_empty (&api->Cancellation_Handlers);
+#else /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */
+ api->last_cleanup_context = NULL;
+#endif /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */
/*
* If the thread is not a posix thread, then all posix signals are blocked