175
// once received signal, there should be a new item in the queue - if there is not item, it means all children are finished
1
using System;
2
using System.Collections.Concurrent;
3
using System.Threading;
4
using System.Linq;
5
using System.Collections.Generic;
6
7
public class Program
8
{
9
public static void Main()
10
{
11
Console.WriteLine("Hello World");
12
}
13
}
14
15
public class Producer
16
{
17
readonly int processorCount = Environment.ProcessorCount;
18
readonly List<Consumer> consumers = new List<Consumer>();
19
ConcurrentQueue<Job> jobs;
20
readonly object queueLock = new object();
21
readonly Semaphore producerSemaphore;
22
readonly Semaphore consumerSemaphore;
23
24
public Producer()
Cached Result