forked from Imagelibrary/rtems
posix: Simplify cleanup push/pop
The POSIX cleanup list must be proteced from asynchronous thread deletion. Here local interrupt disable is sufficient.
This commit is contained in:
@@ -31,7 +31,7 @@ void _pthread_cleanup_push(
|
|||||||
void *arg
|
void *arg
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Per_CPU_Control *cpu_self;
|
ISR_Level level;
|
||||||
Thread_Control *executing;
|
Thread_Control *executing;
|
||||||
|
|
||||||
context->_routine = routine;
|
context->_routine = routine;
|
||||||
@@ -40,13 +40,13 @@ void _pthread_cleanup_push(
|
|||||||
/* This value is unused, just provide a deterministic value */
|
/* This value is unused, just provide a deterministic value */
|
||||||
context->_canceltype = -1;
|
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;
|
context->_previous = executing->last_cleanup_context;
|
||||||
executing->last_cleanup_context = context;
|
executing->last_cleanup_context = context;
|
||||||
|
|
||||||
_Thread_Dispatch_enable( cpu_self );
|
_ISR_Local_enable( level );
|
||||||
}
|
}
|
||||||
|
|
||||||
void _pthread_cleanup_pop(
|
void _pthread_cleanup_pop(
|
||||||
@@ -54,19 +54,19 @@ void _pthread_cleanup_pop(
|
|||||||
int execute
|
int execute
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Per_CPU_Control *cpu_self;
|
ISR_Level level;
|
||||||
Thread_Control *executing;
|
Thread_Control *executing;
|
||||||
|
|
||||||
if ( execute != 0 ) {
|
if ( execute != 0 ) {
|
||||||
( *context->_routine )( context->_arg );
|
( *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;
|
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 )
|
static void _POSIX_Cleanup_terminate_extension( Thread_Control *the_thread )
|
||||||
|
|||||||
Reference in New Issue
Block a user