|
Anatomy of Downloading Window
The Producer-Consumer Problem
Produce(item_t item) {
while (count==bufsz);
buffer[in]=item;
in=(in+1)%bufsz;
count=count+1;
} |
Consume(item_t *item) {
while(count==0);
*item=buffer[out];
out=(out+1)%bufsz;
count=count-1;
} |
Shared Variables |
|
|
buffer, count |
|