summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-01-02 18:56:35 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-01-07 15:13:24 +0100
commit57f125d02595661b72d66f27b6f71c9b9579f516 (patch)
treef6d5050f9c76c9af36e0eda609213c73255433b5 /cpukit
parentrtems: Add comment (diff)
downloadrtems-57f125d02595661b72d66f27b6f71c9b9579f516.tar.bz2
rtems: Critical fix for events
Commit 4b45c1393ce4ee3e1c2762ef3145d2bd6b5b38da marked a test in _Event_Timeout() as debug only. This test is required also in non-debug configurations since otherwise state corruption can happen. A revised test sptests/spintrcritical10 checks the relevant sequences.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/rtems/src/eventtimeout.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/cpukit/rtems/src/eventtimeout.c b/cpukit/rtems/src/eventtimeout.c
index 58dee84b1b..31eb04311e 100644
--- a/cpukit/rtems/src/eventtimeout.c
+++ b/cpukit/rtems/src/eventtimeout.c
@@ -49,13 +49,18 @@ void _Event_Timeout(
* a timeout is not allowed to occur.
*/
_ISR_Disable( level );
- #if defined(RTEMS_DEBUG)
- if ( !the_thread->Wait.count ) { /* verify thread is waiting */
- _Thread_Unnest_dispatch();
- _ISR_Enable( level );
- return;
- }
- #endif
+ /*
+ * Verify that the thread is still waiting for the event condition.
+ * This test is necessary to avoid state corruption if the timeout
+ * happens after the event condition is satisfied in
+ * _Event_Surrender(). A satisfied event condition is indicated with
+ * count set to zero.
+ */
+ if ( !the_thread->Wait.count ) {
+ _Thread_Unnest_dispatch();
+ _ISR_Enable( level );
+ return;
+ }
the_thread->Wait.count = 0;
if ( _Thread_Is_executing( the_thread ) ) {