Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (0 0 1 0) // (elements in queue 1, in queue 2, in queue 3, in queue 4)
- (1 0 1 0)
- (1 1 1 0)
- (0 0 0 0)
- (0 0 0 0)
- (0 0 0 0)
- (1 0 0 0)
- (2 0 0 0)
- (2 1 0 0)
- (1 1 0 1)
- (1 0 0 1)
- (1 0 0 0)
- (1 0 0 0)
- (0 0 0 0)
- (1 0 0 0)
- ...CTRL+c
- #include <iostream>
- #include <queue>
- #include <mutex>
- #include <condition_variable>
- #include <thread>
- #include <random>
- using namespace std;
- // modify this to modify the number of consumer threads
- #define WORKERS_THREADS 4
- // max size of each of four queues
- #define MAX_QUEUE_SIZE 100
- // debug
- #define DEFAULTCOLOR "