linux-sysprog · beginner · ~15 min
Identify the producer back-pressure condition.
Implement int producer_blocks(int count, int cap) returning 1 if the buffer is full (count >= cap), so the next produce must wait.
int producer_blocks(int count, int cap) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.