Ejemplo n.º 1
0
        public Worker(WorkStealingScheduler scheduler, int index)
        {
            this.thread              = new Thread(Work);
            this.thread.Name         = "ParallelTasks Worker " + index;
            this.thread.IsBackground = true;
            this.tasks     = new Deque <Task>();
            this.scheduler = scheduler;
            this.Gate      = new AutoResetEvent(false);

            workers.Add(thread, this);
        }
        public Worker(WorkStealingScheduler scheduler)
        {
            this.thread = new Thread(Work);
            this.thread.Name = "ParallelTasks Worker";
            this.thread.IsBackground = true;
            this.tasks = new Deque<Task>();
            this.scheduler = scheduler;
            this.Gate = new AutoResetEvent(false);

            workers.Add(thread, this);
        }
Ejemplo n.º 3
0
        public Worker(WorkStealingScheduler scheduler, int index, ThreadPriority priority)
        {
            this.thread                  = new Thread(Work);
            this.thread.Name             = "Parallel " + index;
            this.thread.IsBackground     = true;
            this.thread.Priority         = priority;
            this.thread.CurrentCulture   = CultureInfo.InvariantCulture;
            this.thread.CurrentUICulture = CultureInfo.InvariantCulture;
            this.tasks     = new Deque <Task>();
            this.scheduler = scheduler;
            this.Gate      = new AutoResetEvent(false);
            this.HasNoWork = new ManualResetEvent(false);

            workers.Add(thread, this);
        }