From a26603d59850550335b39055079a17e4de1182bc Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 1 Dec 1995 21:06:53 +0000 Subject: Changed code for exit from synchronization state to a switch on the possible synchronization actions. This should have made it harder to avoid a case. --- c/src/exec/rtems/src/event.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'c/src/exec/rtems') diff --git a/c/src/exec/rtems/src/event.c b/c/src/exec/rtems/src/event.c index 2f087b3249..d388de0b81 100644 --- a/c/src/exec/rtems/src/event.c +++ b/c/src/exec/rtems/src/event.c @@ -196,18 +196,26 @@ void _Event_Seize( _Thread_Set_state( executing, STATES_WAITING_FOR_EVENT ); _ISR_Disable( level ); - if ( _Event_Sync == TRUE ) { - _Event_Sync = FALSE; - _ISR_Enable( level ); - return; + switch ( _Event_Sync_state ) { + case EVENT_SYNC_NOTHING_HAPPENED: + _Event_Sync = FALSE; + _ISR_Enable( level ); + return; + case EVENT_SYNC_TIMEOUT: + executing->Wait.return_code = RTEMS_TIMEOUT; + _ISR_Enable( level ); + _Thread_Unblock( executing ); + return; + case EVENT_SYNC_SATISFIED: + if ( _Watchdog_Is_active( &executing->Timer ) ) { + _Watchdog_Deactivate( &executing->Timer ); + _ISR_Enable( level ); + (void) _Watchdog_Remove( &executing->Timer ); + } else + _ISR_Enable( level ); + _Thread_Unblock( executing ); + return; } - if ( _Event_Sync_state == EVENT_SYNC_TIMEOUT ) - executing->Wait.return_code = RTEMS_TIMEOUT; - _ISR_Enable( level ); - if ( ticks ) - (void) _Watchdog_Remove( &executing->Timer ); - _Thread_Unblock( executing ); - return; } /*PAGE -- cgit v1.2.3