- scheduler.QueueExclusive (t);
- }
-
- protected override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
- {
- if (task.Status != TaskStatus.Created)
- return false;
-
- task.RunSynchronously (scheduler.target);
- return true;
- }
-
- protected override IEnumerable<Task> GetScheduledTasks ()
- {
- throw new NotImplementedException ();
- }
- }
-
- class ConcurrentTaskScheduler : TaskScheduler
- {
- ConcurrentExclusiveSchedulerPair scheduler;
-
- public ConcurrentTaskScheduler (ConcurrentExclusiveSchedulerPair scheduler)
- {
- this.scheduler = scheduler;
- }
-
- public override int MaximumConcurrencyLevel {
- get {
- return scheduler.maxConcurrencyLevel;
- }
- }
-
- protected override void QueueTask (Task t)
- {
- scheduler.QueueConcurrent (t);