From 0e658d456c9c36bc7bfcfdc55e684a0991c5ea8f Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 9 Nov 2016 16:29:17 +0100 Subject: posix: Simplify cleanup push/pop The POSIX cleanup list must be proteced from asynchronous thread deletion. Here local interrupt disable is sufficient. --- cpukit/posix/src/cleanuppush.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cpukit/posix/src/cleanuppush.c b/cpukit/posix/src/cleanuppush.c index 0e5545898d..d3d7c8fe43 100644 --- a/cpukit/posix/src/cleanuppush.c +++ b/cpukit/posix/src/cleanuppush.c @@ -31,8 +31,8 @@ void _pthread_cleanup_push( void *arg ) { - Per_CPU_Control *cpu_self; - Thread_Control *executing; + ISR_Level level; + Thread_Control *executing; context->_routine = routine; context->_arg = arg; @@ -40,13 +40,13 @@ void _pthread_cleanup_push( /* This value is unused, just provide a deterministic value */ context->_canceltype = -1; - cpu_self = _Thread_Dispatch_disable(); + _ISR_Local_disable( level ); - executing = _Per_CPU_Get_executing( cpu_self ); + executing = _Thread_Executing; context->_previous = executing->last_cleanup_context; executing->last_cleanup_context = context; - _Thread_Dispatch_enable( cpu_self ); + _ISR_Local_enable( level ); } void _pthread_cleanup_pop( @@ -54,19 +54,19 @@ void _pthread_cleanup_pop( int execute ) { - Per_CPU_Control *cpu_self; - Thread_Control *executing; + ISR_Level level; + Thread_Control *executing; if ( execute != 0 ) { ( *context->_routine )( context->_arg ); } - cpu_self = _Thread_Dispatch_disable(); + _ISR_Local_disable( level ); - executing = _Per_CPU_Get_executing( cpu_self ); + executing = _Thread_Executing; executing->last_cleanup_context = context->_previous; - _Thread_Dispatch_enable( cpu_self ); + _ISR_Local_enable( level ); } static void _POSIX_Cleanup_terminate_extension( Thread_Control *the_thread ) -- cgit v1.2.3