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 AsyncQueue(int?capacity) { if (capacity.HasValue && capacity.Value < 1) { // ReSharper disable once NotResolvedInText throw new ArgumentOutOfRangeException("Capacity must be at least one"); } this.syncRoot = new object(); this.capacity = capacity; this.readPtr = BigInteger.Zero; this.readLocked = null; this.writeLocked = null; this.eofSignaled = false; this.items = ImmutableList <T> .Empty; this.waitingReads = new CancellableQueue <WaitingRead>(); this.waitingWrites = new CancellableQueue <WaitingWrite>(); }
public IdleDetector() { syncRoot = new object(); referenceCount = 0; waiters = new CancellableQueue <Waiter>(); }