Пример #1
0
        void ISchedulable.Schedule(TaskScheduler scheduler, IFuture future)
        {
            if (_Schedulables == null)
            {
                throw new InvalidOperationException();
            }
            else if (_Schedulables.Length == 0)
            {
                future.Complete();
                return;
            }

            for (int i = 0; i < _Schedulables.Length; i++)
            {
                var s = _Schedulables[i];
                if (s != null)
                {
                    _Futures[i] = scheduler.Start(s, TaskExecutionPolicy.RunWhileFutureLives);
                }
            }

            _Schedulables = null;
            _ResultFuture = future;

            _WaitFuture = Future.WaitForAll(_Futures);
            _WaitFuture.RegisterHandlers(HandleResult, HandleDisposed);
        }
Пример #2
0
 void SetWakeConditionAndSubscribe(IFuture f, bool discardingResult)
 {
     SetWakeCondition(f, discardingResult);
     f.RegisterHandlers(_QueueStepOnComplete, _QueueStepOnDispose);
 }