forked from Imagelibrary/rtems
posix: Protect alarm()
Use thread dispatch disable/enable to ensure thread level mutual exlusion.
This commit is contained in:
@@ -57,6 +57,8 @@ unsigned int alarm(
|
|||||||
|
|
||||||
the_timer = &_POSIX_signals_Alarm_timer;
|
the_timer = &_POSIX_signals_Alarm_timer;
|
||||||
|
|
||||||
|
_Thread_Disable_dispatch();
|
||||||
|
|
||||||
state = _Watchdog_Remove( the_timer );
|
state = _Watchdog_Remove( the_timer );
|
||||||
if ( (state == WATCHDOG_ACTIVE) || (state == WATCHDOG_REMOVE_IT) ) {
|
if ( (state == WATCHDOG_ACTIVE) || (state == WATCHDOG_REMOVE_IT) ) {
|
||||||
/*
|
/*
|
||||||
@@ -72,5 +74,7 @@ unsigned int alarm(
|
|||||||
if ( seconds )
|
if ( seconds )
|
||||||
_Watchdog_Insert_seconds( the_timer, seconds );
|
_Watchdog_Insert_seconds( the_timer, seconds );
|
||||||
|
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
|
|
||||||
return remaining;
|
return remaining;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user