- Threads_int_Sleep(THREAD_STAT_EVENTSLEEP, NULL, EventMask,
- &us, NULL, &us->IsLocked);
- // Woken when lock is acquired
- SHORTLOCK( &us->IsLocked );
+ if( (us->EventState & EventMask) == 0 )
+ {
+ Threads_int_Sleep(THREAD_STAT_EVENTSLEEP, NULL, EventMask,
+ &us, NULL, &us->IsLocked);
+ // Woken when lock is acquired
+ SHORTLOCK( &us->IsLocked );
+ }