Exemple #1
0
void producer(thread_safe_queue<int> &q, unsigned int num_iterations, unsigned int num_consumers)
{
    std::cout << "producer" << std::endl;

    for(int i = 0; i < num_iterations; ++i)
        q.push(i);

    for(int i = 0; i < num_consumers; ++i)
        q.push(-1);
}
 void push_thread(thread_safe_queue<long long int>& q, long long int j)
 {
     long long int start = 10000 * j;
     for(long long int i = start; i < start + 10000; ++i)
     {
         q.push(i);
     }
 }
 void push_thread(thread_safe_queue<long long int>& q, long long int j)
 {
     long long int start = queue_size * j;
     for(long long int i = start; i < start + queue_size; ++i)
     {
         q.push(i);
     }
 }