diff options
Diffstat (limited to 'cpukit/posix/src/cleanuppush.c')
-rw-r--r-- | cpukit/posix/src/cleanuppush.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/cpukit/posix/src/cleanuppush.c b/cpukit/posix/src/cleanuppush.c index 84dbc0043d..9d11c0553f 100644 --- a/cpukit/posix/src/cleanuppush.c +++ b/cpukit/posix/src/cleanuppush.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 @@ -66,3 +68,30 @@ void pthread_cleanup_push( } _Thread_Enable_dispatch(); } + +#else /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ + +void _pthread_cleanup_push( + struct _pthread_cleanup_context *context, + void ( *routine )( void * ), + void *arg +) +{ + POSIX_API_Control *thread_support; + + context->_routine = routine; + context->_arg = arg; + + /* This value is unused, just provide a deterministic value */ + context->_canceltype = -1; + + _Thread_Disable_dispatch(); + + thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; + context->_previous = thread_support->last_cleanup_context; + thread_support->last_cleanup_context = context; + + _Thread_Enable_dispatch(); +} + +#endif /* HAVE_STRUCT__PTHREAD_CLEANUP_CONTEXT */ |