forked from Imagelibrary/rtems
2003-10-13 Joel Sherrill <joel@OARcorp.com>
* src/cleanuppop.c, src/cleanuppush.c: Protect use of _Workspace_Allocate and _Workspec_Free.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2003-10-13 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
|
* src/cleanuppop.c, src/cleanuppush.c: Protect use of
|
||||||
|
_Workspace_Allocate and _Workspec_Free.
|
||||||
|
|
||||||
2003-09-04 Joel Sherrill <joel@OARcorp.com>
|
2003-09-04 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
* include/rtems/posix/cond.h, include/rtems/posix/condmp.h,
|
* include/rtems/posix/cond.h, include/rtems/posix/condmp.h,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ void pthread_cleanup_pop(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
POSIX_Cancel_Handler_control *handler;
|
POSIX_Cancel_Handler_control *handler;
|
||||||
|
POSIX_Cancel_Handler_control tmp_handler;
|
||||||
Chain_Control *handler_stack;
|
Chain_Control *handler_stack;
|
||||||
POSIX_API_Control *thread_support;
|
POSIX_API_Control *thread_support;
|
||||||
ISR_Level level;
|
ISR_Level level;
|
||||||
@@ -36,17 +37,24 @@ void pthread_cleanup_pop(
|
|||||||
|
|
||||||
handler_stack = &thread_support->Cancellation_Handlers;
|
handler_stack = &thread_support->Cancellation_Handlers;
|
||||||
|
|
||||||
if ( _Chain_Is_empty( handler_stack ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
_ISR_Disable( level );
|
_ISR_Disable( level );
|
||||||
|
if ( _Chain_Is_empty( handler_stack ) ) {
|
||||||
|
_ISR_Enable( level );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
handler = (POSIX_Cancel_Handler_control *)
|
handler = (POSIX_Cancel_Handler_control *)
|
||||||
_Chain_Tail( handler_stack )->previous;
|
_Chain_Tail( handler_stack )->previous;
|
||||||
_Chain_Extract_unprotected( &handler->Node );
|
_Chain_Extract_unprotected( &handler->Node );
|
||||||
|
|
||||||
_ISR_Enable( level );
|
_ISR_Enable( level );
|
||||||
|
|
||||||
|
tmp_handler = *handler;
|
||||||
|
|
||||||
|
_Thread_Disable_dispatch();
|
||||||
|
_Workspace_Free( handler );
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
|
|
||||||
if ( execute )
|
if ( execute )
|
||||||
(*handler->routine)( handler->arg );
|
(*tmp_handler.routine)( tmp_handler.arg );
|
||||||
|
|
||||||
_Workspace_Free( handler );
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,13 @@ void pthread_cleanup_push(
|
|||||||
if ( !routine )
|
if ( !routine )
|
||||||
return; /* XXX what to do really? */
|
return; /* XXX what to do really? */
|
||||||
|
|
||||||
|
_Thread_Disable_dispatch();
|
||||||
handler = _Workspace_Allocate( sizeof( POSIX_Cancel_Handler_control ) );
|
handler = _Workspace_Allocate( sizeof( POSIX_Cancel_Handler_control ) );
|
||||||
|
|
||||||
if ( !handler )
|
if ( !handler ) {
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
return; /* XXX what to do really? */
|
return; /* XXX what to do really? */
|
||||||
|
}
|
||||||
|
|
||||||
thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||||
|
|
||||||
@@ -48,4 +51,6 @@ void pthread_cleanup_push(
|
|||||||
handler->arg = arg;
|
handler->arg = arg;
|
||||||
|
|
||||||
_Chain_Append( handler_stack, &handler->Node );
|
_Chain_Append( handler_stack, &handler->Node );
|
||||||
|
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user