public ParallelWorker(int workerCount) { if (workerCount < 1) { throw new ArgumentException(nameof(workerCount)); } this.syncRoot = new object(); this.capacity = workerCount; this.idleWorkers = ImmutableHashSet <int> .Empty.Union(Enumerable.Range(0, workerCount)); this.busyWorkers = ImmutableHashSet <int> .Empty; this.waitingWorkItems = new CancellableQueue <WaitingWorkItem>(); }
public IdleDetector() { syncRoot = new object(); referenceCount = 0; waiters = new CancellableQueue <Waiter>(); }