forked from Imagelibrary/rtems
posix: Protect ualarm()
Use thread dispatch disable/enable to ensure thread level mutual exlusion.
This commit is contained in:
@@ -69,6 +69,8 @@ useconds_t ualarm(
|
||||
|
||||
the_timer = &_POSIX_signals_Ualarm_timer;
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
state = _Watchdog_Remove( the_timer );
|
||||
if ( (state == WATCHDOG_ACTIVE) || (state == WATCHDOG_REMOVE_IT) ) {
|
||||
/*
|
||||
@@ -103,5 +105,7 @@ useconds_t ualarm(
|
||||
_Watchdog_Insert_ticks( the_timer, _Timespec_To_ticks( &tp ) );
|
||||
}
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
return remaining;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user