diff options
Diffstat (limited to 'cpukit/posix/src/cleanuppop.c')
-rw-r--r-- | cpukit/posix/src/cleanuppop.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/cpukit/posix/src/cleanuppop.c b/cpukit/posix/src/cleanuppop.c index 4ec7084fdd..7afe9e6cd0 100644 --- a/cpukit/posix/src/cleanuppop.c +++ b/cpukit/posix/src/cleanuppop.c @@ -19,16 +19,18 @@ #endif #include <pthread.h> -#include <errno.h> -#include <rtems/system.h> +#include <rtems/score/thread.h> +#include <rtems/score/threaddispatch.h> +#include <rtems/posix/threadsup.h> + +#ifndef HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT + #include <rtems/score/chainimpl.h> #include <rtems/score/isr.h> -#include <rtems/score/thread.h> #include <rtems/score/wkspace.h> #include <rtems/posix/cancel.h> #include <rtems/posix/pthreadimpl.h> -#include <rtems/posix/threadsup.h> /* * 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184 @@ -79,3 +81,26 @@ void pthread_cleanup_pop( if ( execute ) (*tmp_handler.routine)( tmp_handler.arg ); } + +#else /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ + +void _pthread_cleanup_pop( + struct _pthread_cleanup_context *context, + int execute +) +{ + POSIX_API_Control *thread_support; + + if ( execute != 0 ) { + ( *context->_routine )( context->_arg ); + } + + _Thread_Disable_dispatch(); + + thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; + thread_support->last_cleanup_context = context->_previous; + + _Thread_Enable_dispatch(); +} + +#endif /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ |