/// <summary> /// Конструктор Segment /// </summary> /// <param name="parent">Очередь - владелец сегмента</param> public Segment(ThreadPoolConcurrentQueue parent) { TurboContract.Requires(parent != null, conditionString: "parent != null"); _parent = parent; _data = new ThreadPoolWorkItem[SegmentSize]; _head = 0; _tail = 0; }
/// <summary> /// Конструктор Segment /// </summary> /// <param name="parent">Очередь - владелец сегмента</param> public Segment(ThreadPoolConcurrentQueue parent) { Contract.Requires(parent != null); _parent = parent; _data = new ThreadPoolWorkItem[SegmentSize]; _head = 0; _tail = 0; }
/// <summary> /// Конструктор ThreadPoolQueue /// </summary> /// <param name="boundedCapacity">Ограничение размера</param> public ThreadPoolGlobalQueue(int boundedCapacity) { _boundedCapacity = boundedCapacity > 0 ? boundedCapacity : -1; _extendedCapacityRequest = 0; _mainQueue = new ThreadPoolConcurrentQueue(); _safeDisposeLock = new object(); _freeNodes = null; if (boundedCapacity > 0) { _freeNodes = new SemaphoreLight(boundedCapacity); } _occupiedNodes = new SemaphoreLight(0); }