Assertion: semaphore's queue | /r/HasProperty | empty
Facets:
Source sentences:
text: the consumer must wait for the producer to produce something if the queue is empty;
text: the producer must wait for the consumer to consume something if the queue is full.
text: This adds an item to the head of the queue and notifies the waiting thread(s) that the queue is nonempty.
text: The queue can therefore only be empty or full (hence binary).
text: Tasks and interrupts using the queue don’t care what the queue holds – they only want to know if the queue is empty or full.
text: For instance, if you have a thread (or multiple threads) that can't continue onward until a queue is empty, the busy waiting approach would be to just doing something like:
text: When the queue is empty, it can call syncVar.signal() to wake up a random thread that is sitting asleep on syncVar.wait() (or there's usually also a signalAll() or broadcast() method to wake up all the threads that are waiting).
text: I generally use synchronization variables like this when I have one or more threads waiting on a single particular condition (e.g. for the queue to be empty).
text: If the queue is empty, this call blocks.
text: If the counter gets decremented to zero, the client thread is put to sleep because there isn't a slot available: the queue is full.
text: The queue can therefore only be empty or full (hence binary).
text: Tasks and interrupts using the queue don’t care what the queue holds – they only want to know if the queue is empty or full.