From 927a0a1f990c19a3e7295bb001896b3f3c75a77e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 2 Dec 2013 08:33:35 +0100 Subject: posix: Use cleanup contexts on the stack Provide support for latest Newlib 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. --- cpukit/posix/include/rtems/posix/threadsup.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cpukit/posix/include/rtems/posix/threadsup.h') diff --git a/cpukit/posix/include/rtems/posix/threadsup.h b/cpukit/posix/include/rtems/posix/threadsup.h index 7bd1f934ad..6bb3b844cc 100644 --- a/cpukit/posix/include/rtems/posix/threadsup.h +++ b/cpukit/posix/include/rtems/posix/threadsup.h @@ -80,8 +80,15 @@ typedef struct { int cancelability_type; /** This indicates if a cancelation has been requested. */ int cancelation_requested; +#ifndef HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT /** This is the set of cancelation handlers. */ Chain_Control Cancellation_Handlers; +#else /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ + /** + * @brief LIFO list of cleanup contexts. + */ + struct _pthread_cleanup_context *last_cleanup_context; +#endif /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ /** * This is the thread key value chain's control, which is used -- cgit v1.2.3