public TaskScheduler(Func <IJobQueue> JobQueueFactory) { _JobQueue = JobQueueFactory(); _SleepWorker = new Internal.WorkerThread <PriorityQueue <SleepItem> >( SleepWorkerThreadFunc, ThreadPriority.AboveNormal, "TaskScheduler Sleep Provider" ); }
public TaskScheduler(Func <IJobQueue> JobQueueFactory, ITimeProvider timeProvider = null, Thread mainThread = null) { MainThread = mainThread ?? Thread.CurrentThread; TimeProvider = timeProvider ?? Time.DefaultTimeProvider; BackgroundTaskOnComplete = _BackgroundTaskOnComplete; OnResolvedDispatcher = _OnResolvedDispatcher; OnResolvedDispatcher_SkipQueue = _OnResolvedDispatcher_SkipQueue; mOnResolvedDispatcher_SkipQueue = GetType().GetMethod("_OnResolvedDispatcher_SkipQueue_Generic", BindingFlags.Instance | BindingFlags.NonPublic); _JobQueue = JobQueueFactory(); _SleepWorker = new Internal.WorkerThread <PriorityQueue <SleepItem> >( SleepWorkerThreadFunc, ThreadPriority.AboveNormal, "TaskScheduler Sleep Provider" ); SynchronizationContext = new TaskSchedulerSynchronizationContext(this); if (!_Default.IsValueCreated) { _Default.Value = this; WorkItemQueueTarget.SetDefaultIfNone(this); } else { _Default.Value = null; } }
public TaskScheduler(Func <IJobQueue> JobQueueFactory, ITimeProvider timeProvider = null) { TimeProvider = timeProvider ?? Time.DefaultTimeProvider; _JobQueue = JobQueueFactory(); _SleepWorker = new Internal.WorkerThread <PriorityQueue <SleepItem> >( SleepWorkerThreadFunc, ThreadPriority.AboveNormal, "TaskScheduler Sleep Provider" ); _SynchronizationContext = new TaskSchedulerSynchronizationContext(this); if (!_Default.IsValueCreated) { _Default.Value = this; } else { _Default.Value = null; } }