[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


B.12.5 Event Flags

All event flags are shared by all threads in the process. Therefore, it is possible for different threads' use of the same event flag to cause interference. That is, if two threads use the same event flag in calls to different system services, whichever service completes first will cause both threads to awaken, even though the other service has not completed. This situation can be resolved by specifying an I/O Status Block (IOSB) for those system services that use them. When an IOSB is present, the blocked thread will not be awakened when the event flag is set, unless the IOSB has also been written.

Note that a DECthreads process will rarely be in "LEF" state. In general, instead of blocking for an event flag wait, DECthreads will schedule another thread to be run. If no threads are available, DECthreads will schedule a "null" thread which will place the virtual processor in "HIB" state until it is needed to execute a thread.

Note that no upcall is made for waits on a common event flag. If a thread waits on a common event flag, the virtual processor will block until the wait is satisfied. (On a uniprocessor, this will most likely block all threads.)