Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        public HttpServer(TaskScheduler scheduler)
        {
            EndPoints = new EndPointList(this);

            Scheduler = scheduler;

            RequestOnComplete = _RequestOnComplete;
        }
Esempio n. 3
0
 public SchedulableGeneratorThunk(IEnumerator <object> task)
 {
     _Task                = task;
     _QueueStep           = QueueStep;
     _QueueStepOnComplete = QueueStepOnComplete;
     _QueueStepOnDispose  = QueueStepOnDispose;
     _OnErrorChecked      = OnErrorChecked;
     _Step                = Step;
 }
Esempio n. 4
0
 /// <summary>
 /// Registers an OnResolved handler onto a specified future that will push the onComplete handler
 ///  onto this scheduler's work queue once the future is completed or disposed.
 /// </summary>
 /// <param name="skipQueueOnMainThread">If the future is completed/disposed from the main thread, run the handler synchronously</param>
 public void RegisterOnResolved <T> (Future <T> f, OnFutureResolved <T> onComplete, bool skipQueueOnMainThread = false)
 {
     RegisterOnResolved_Impl(f, onComplete, skipQueueOnMainThread);
 }
Esempio n. 5
0
 /// <summary>
 /// Registers an OnResolved handler onto a specified future that will push the onComplete handler
 ///  onto this scheduler's work queue once the future is completed or disposed.
 /// </summary>
 /// <param name="skipQueueOnMainThread">If the future is completed/disposed from the main thread, run the handler synchronously</param>
 public void RegisterOnResolved(IFuture f, OnFutureResolved onResolved, bool skipQueueOnMainThread = false)
 {
     RegisterOnResolved_Impl(f, onResolved, skipQueueOnMainThread);
 }
Esempio n. 6
0
File: IO.cs Progetto: sq/Libraries
 public WriteThunk()
 {
     Result          = new SignalFuture();
     FlushOnComplete = _FlushOnComplete;
 }
Esempio n. 7
0
File: IO.cs Progetto: sq/Libraries
 public ReadToEndThunk()
 {
     Buffer           = new CharacterBuffer();
     OnDecodeComplete = _OnDecodeComplete;
 }
Esempio n. 8
0
File: IO.cs Progetto: sq/Libraries
 public ReadBlockThunk()
 {
     OnDecodeComplete = _OnDecodeComplete;
 }
Esempio n. 9
0
File: IO.cs Progetto: sq/Libraries
 internal PendingOperationManager()
 {
     OperationOnComplete = _OperationOnComplete;
 }
Esempio n. 10
0
File: Util.cs Progetto: sq/Libraries
 public OwnedFutureSet()
 {
     _OnComplete = OnComplete;
     _OnDispose  = OnDispose;
 }