diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-09 16:29:17 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-18 07:30:31 +0100 |
commit | 0e658d456c9c36bc7bfcfdc55e684a0991c5ea8f (patch) | |
tree | 44376dee3910b54c078fed9bea08eb7b55d7d7ee | |
parent | sptests/sp37: Better cope with internal padding (diff) | |
download | rtems-0e658d456c9c36bc7bfcfdc55e684a0991c5ea8f.tar.bz2 |
posix: Simplify cleanup push/pop
The POSIX cleanup list must be proteced from asynchronous thread
deletion. Here local interrupt disable is sufficient.
-rw-r--r-- | cpukit/posix/src/cleanuppush.c | 20 |
1 files 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 ) |