summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2004-02-26 17:04:44 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2004-02-26 17:04:44 +0000
commitf4548e9f812f7504e14992fc909cfc8da9a58974 (patch)
tree481fdb4702b14d56849ed5f72988a2ad1291bbfc /cpukit/rtems
parent2004-02-26 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-f4548e9f812f7504e14992fc909cfc8da9a58974.tar.bz2
2004-02-26 Thomas Rauscher <trauscher@loytec.com.
PR 584/RTEMS * rtems/src/eventtimeout.c: Fix critical section window.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/src/eventtimeout.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/cpukit/rtems/src/eventtimeout.c b/cpukit/rtems/src/eventtimeout.c
index 027ce3d981..03b6430fb4 100644
--- a/cpukit/rtems/src/eventtimeout.c
+++ b/cpukit/rtems/src/eventtimeout.c
@@ -39,8 +39,9 @@ void _Event_Timeout(
void *ignored
)
{
- Thread_Control *the_thread;
- Objects_Locations location;
+ Thread_Control *the_thread;
+ Objects_Locations location;
+ ISR_Level level;
the_thread = _Thread_Get( id, &location );
switch ( location ) {
@@ -61,14 +62,25 @@ void _Event_Timeout(
* a timeout is not allowed to occur.
*/
- 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 {
- the_thread->Wait.return_code = RTEMS_TIMEOUT;
- _Thread_Unblock( the_thread );
+ _ISR_Disable( level );
+ if ( the_thread->Wait.count ) { /* verify thread is waiting */
+ the_thread->Wait.count = 0;
+ 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;
+ }
+ _ISR_Enable( level );
+ } else {
+ the_thread->Wait.return_code = RTEMS_TIMEOUT;
+ _ISR_Enable( level );
+ _Thread_Unblock( the_thread );
+ }
}
+ else {
+ _ISR_Enable( level );
+ }
+
_Thread_Unnest_dispatch();
break;
}