System.Threading.Tasks.ThreadWorker.ThreadWorker C# (CSharp) Method

ThreadWorker() public method

public ThreadWorker ( IScheduler sched, ThreadWorker others, IProducerConsumerCollection sharedWorkQueue, bool createThread, int maxStackSize, ThreadPriority priority ) : System
sched IScheduler
others ThreadWorker
sharedWorkQueue IProducerConsumerCollection
createThread bool
maxStackSize int
priority ThreadPriority
return System
		public ThreadWorker (IScheduler sched, ThreadWorker[] others, IProducerConsumerCollection<Task> sharedWorkQueue,
		                     bool createThread, int maxStackSize, ThreadPriority priority)
		{
			this.others          = others;

//			if (!string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("USE_CYCLIC"))) {
//				Console.WriteLine ("Using cyclic deque");
//				this.dDeque = new CyclicDeque<Task> ();
//			} else {
//				this.dDeque = new DynamicDeque<Task> ();
//			}
			this.dDeque = new CyclicDeque<Task> ();
			
			this.sharedWorkQueue = sharedWorkQueue;
			this.workerLength    = others.Length;
			this.isLocal         = !createThread;
			
			this.childWorkAdder = delegate (Task t) { 
				dDeque.PushBottom (t);
				sched.PulseAll ();
			};
			
			// Find the stealing start index randomly (then the traversal
			// will be done in Round-Robin fashion)
			do {
				this.stealingStart = r.Next(0, workerLength);
			} while (others[stealingStart] == this);
			
			InitializeUnderlyingThread (maxStackSize, priority);
		}
		

Same methods

ThreadWorker::ThreadWorker ( IScheduler sched, ThreadWorker others, IProducerConsumerCollection sharedWorkQueue, int maxStackSize, ThreadPriority priority ) : System