|
CITS2002 Systems Programming |
| ← prev | next → |
CITS2002 |
CITS2002 schedule |
|||
A condition variable exampleLet's consider a typical 'producer/consumer' example, in which the producer() thread create items and makes them available, and the consumer() thread uses them.This is a very typical problem requiring synchronization as we don't wish either thread to block indefinitely waiting for the other, and the consumer should only execute when it's known that there's at least one new item available:
CITS2002 Systems Programming, Lecture 21, p7, 10th October 2023.
|