In multithreaded programming, it’s important to make threads wait. They must wait for exclusive access to a resource. They must wait when there …
The box office cannot directly check how many threads are waiting on the semaphore, nor can it check the semaphores current signal count.
After they visit the box office, they may operate on the semaphore in an unpredictable order, but thats OK. As Ive already explained, the outcome will remain valid regardless of the order in which those semaphore operations occur.
All of the autoreset event logic can be implemented at the box office using atomic operations, and the box office will invoke the semaphore only when its absolutely necessary for threads to wait.
In such cases, the box office will rely entirely on atomic operations, leaving the underlying semaphore untouched.
1
u/samacharbot2 Dec 28 '16
In multithreaded programming, it’s important to make threads wait. They must wait for exclusive access to a resource. They must wait when there …
Here are some other news items:credits to u-sr33
I'm a bot | OP can reply with "delete" to remove | Message ^Creator | ^Source | Did I just break? See how you can help! Visit the source and check out the Readme