Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 489

The Producer-Consumer Problem (also known as the bounded-buffer problem) is a classical example of a multi-process synchronization problem. The problem describes two processes, the producer and the consumer, who share a common, fixed-size buffer used as a queue.

6 votes

C++ lock free, single producer, single consumer queue

This is sort of an extended comment on Martin York's reply. When you're doing any sort of parallel processing, I advise against re-designing pop so it requires two operations to actually remove an it …
Jerry Coffin's user avatar
  • 33.6k
1 vote
Accepted

Notifying consumers when a producer is done

Let's start with pop. As many have noted, a pop that returns the value being removed from the collection can (will) cause problems unless copying (or moving) the value is guaranteed to be exception fr …
Jerry Coffin's user avatar
  • 33.6k
1 vote

Producer/consumer problem with four priority levels

struct definition Although the typedef struct tag { /* body */ } name; style is common in C, it's unnecessary in C++. You can just use: class name { /* body */ }; and get essentially the same effect. …
Jerry Coffin's user avatar
  • 33.6k