A "work stealing" work scheduler class. This can give much better performance than SimpleScheduler when tasks often launch sub-tasks.
Inheritance: IWorkScheduler
Example #1
0
        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);
        }
Example #2
0
        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);
        }