From 7f6fab613a58b018dfe051b1dd2cca49a14c222b Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 1 Dec 1995 19:28:52 +0000 Subject: Made _Event_Sync volatile Replaced critical section algorithm to correct race conditions. This resulted in the new variable _Event_Sync_state and the type _Event_Sync_states. --- c/src/exec/rtems/headers/event.h | 17 +++++++++++++++-- c/src/exec/rtems/include/rtems/rtems/event.h | 17 +++++++++++++++-- cpukit/rtems/include/rtems/rtems/event.h | 17 +++++++++++++++-- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/c/src/exec/rtems/headers/event.h b/c/src/exec/rtems/headers/event.h index 02cd5ea0c2..1272af576b 100644 --- a/c/src/exec/rtems/headers/event.h +++ b/c/src/exec/rtems/headers/event.h @@ -42,6 +42,18 @@ extern "C" { #define EVENT_CURRENT 0 +/* + * The following enumerated types indicate what happened while the event + * manager was in the synchronization window. + */ + +typedef enum { + EVENT_SYNC_NOTHING_HAPPENED, + EVENT_SYNC_TIMEOUT, + EVENT_SYNC_SATISFIED +} Event_Sync_states; + + /* * _Event_Manager_initialization * @@ -142,12 +154,13 @@ void _Event_Timeout ( ); /* - * The following defines the synchronization flag used by the + * The following defines the synchronization flags used by the * Event Manager to insure that signals sent to the currently * executing thread are received properly. */ -EXTERN boolean _Event_Sync; /* event manager sync flag */ +EXTERN volatile boolean _Event_Sync; +EXTERN volatile Event_Sync_states _Event_Sync_state; #include #include diff --git a/c/src/exec/rtems/include/rtems/rtems/event.h b/c/src/exec/rtems/include/rtems/rtems/event.h index 02cd5ea0c2..1272af576b 100644 --- a/c/src/exec/rtems/include/rtems/rtems/event.h +++ b/c/src/exec/rtems/include/rtems/rtems/event.h @@ -42,6 +42,18 @@ extern "C" { #define EVENT_CURRENT 0 +/* + * The following enumerated types indicate what happened while the event + * manager was in the synchronization window. + */ + +typedef enum { + EVENT_SYNC_NOTHING_HAPPENED, + EVENT_SYNC_TIMEOUT, + EVENT_SYNC_SATISFIED +} Event_Sync_states; + + /* * _Event_Manager_initialization * @@ -142,12 +154,13 @@ void _Event_Timeout ( ); /* - * The following defines the synchronization flag used by the + * The following defines the synchronization flags used by the * Event Manager to insure that signals sent to the currently * executing thread are received properly. */ -EXTERN boolean _Event_Sync; /* event manager sync flag */ +EXTERN volatile boolean _Event_Sync; +EXTERN volatile Event_Sync_states _Event_Sync_state; #include #include diff --git a/cpukit/rtems/include/rtems/rtems/event.h b/cpukit/rtems/include/rtems/rtems/event.h index 02cd5ea0c2..1272af576b 100644 --- a/cpukit/rtems/include/rtems/rtems/event.h +++ b/cpukit/rtems/include/rtems/rtems/event.h @@ -42,6 +42,18 @@ extern "C" { #define EVENT_CURRENT 0 +/* + * The following enumerated types indicate what happened while the event + * manager was in the synchronization window. + */ + +typedef enum { + EVENT_SYNC_NOTHING_HAPPENED, + EVENT_SYNC_TIMEOUT, + EVENT_SYNC_SATISFIED +} Event_Sync_states; + + /* * _Event_Manager_initialization * @@ -142,12 +154,13 @@ void _Event_Timeout ( ); /* - * The following defines the synchronization flag used by the + * The following defines the synchronization flags used by the * Event Manager to insure that signals sent to the currently * executing thread are received properly. */ -EXTERN boolean _Event_Sync; /* event manager sync flag */ +EXTERN volatile boolean _Event_Sync; +EXTERN volatile Event_Sync_states _Event_Sync_state; #include #include -- cgit v1.2.3