summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/event.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1996-02-09 14:30:42 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1996-02-09 14:30:42 +0000
commit107ce47b4b7be469696406948d2d2c1b01357b6b (patch)
tree91d1807bc741f2d6e7634f2a327239c51f4c5836 /cpukit/rtems/src/event.c
parent6dae1c2d0bec2337300e553a9fd0c29f4c13d143 (diff)
downloadrtems-107ce47b4b7be469696406948d2d2c1b01357b6b.tar.bz2
new isr synchronization algorithm using a single enumerated set of states.
Diffstat (limited to '')
-rw-r--r--cpukit/rtems/src/event.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/cpukit/rtems/src/event.c b/cpukit/rtems/src/event.c
index 9bea949647..3042de2676 100644
--- a/cpukit/rtems/src/event.c
+++ b/cpukit/rtems/src/event.c
@@ -144,6 +144,7 @@ void _Event_Seize(
rtems_event_set pending_events;
ISR_Level level;
RTEMS_API_Control *api;
+ Event_Sync_states sync_state;
executing = _Thread_Executing;
executing->Wait.return_code = RTEMS_SUCCESSFUL;
@@ -170,7 +171,6 @@ void _Event_Seize(
return;
}
- _Event_Sync = TRUE;
_Event_Sync_state = EVENT_SYNC_NOTHING_HAPPENED;
executing->Wait.option = (unsigned32) option_set;
@@ -192,9 +192,13 @@ void _Event_Seize(
_Thread_Set_state( executing, STATES_WAITING_FOR_EVENT );
_ISR_Disable( level );
- switch ( _Event_Sync_state ) {
+
+ sync_state = _Event_Sync_state;
+ _Event_Sync_state = EVENT_SYNC_SYNCHRONIZED;
+
+ switch ( sync_state ) {
+ case EVENT_SYNC_SYNCHRONIZED:
case EVENT_SYNC_NOTHING_HAPPENED:
- _Event_Sync = FALSE;
_ISR_Enable( level );
return;
case EVENT_SYNC_TIMEOUT:
@@ -274,12 +278,24 @@ void _Event_Surrender(
return;
}
}
- else if ( _Event_Sync == TRUE && _Thread_Is_executing( the_thread ) ) {
- if ( seized_events == event_condition || _Options_Is_any( option_set ) ) {
- api->pending_events = _Event_sets_Clear( pending_events,seized_events );
- *(rtems_event_set *)the_thread->Wait.return_argument = seized_events;
- _Event_Sync_state = EVENT_SYNC_SATISFIED;
- }
+
+ switch ( _Event_Sync_state ) {
+ case EVENT_SYNC_SYNCHRONIZED:
+ case EVENT_SYNC_SATISFIED:
+ break;
+
+ case EVENT_SYNC_NOTHING_HAPPENED:
+ case EVENT_SYNC_TIMEOUT:
+ if ( !_Thread_Is_executing( the_thread ) )
+ break;
+
+ if ( seized_events == event_condition || _Options_Is_any(option_set) ) {
+ api->pending_events =
+ _Event_sets_Clear( pending_events,seized_events );
+ *(rtems_event_set *)the_thread->Wait.return_argument = seized_events;
+ _Event_Sync_state = EVENT_SYNC_SATISFIED;
+ }
+ break;
}
}
_ISR_Enable( level );
@@ -312,7 +328,8 @@ void _Event_Timeout(
case OBJECTS_REMOTE: /* impossible */
break;
case OBJECTS_LOCAL:
- if ( _Event_Sync == TRUE && _Thread_Is_executing( the_thread ) ) {
+ if ( _Event_Sync_state != EVENT_SYNC_SYNCHRONIZED &&
+ _Thread_Is_executing( the_thread ) ) {
if ( _Event_Sync_state != EVENT_SYNC_SATISFIED )
_Event_Sync_state = EVENT_SYNC_TIMEOUT;
} else {