public static void Subscribe <T>( this Schedulable <T> schedulable, IScheduler scheduler, Action <T> onCompleted, Action <Exception> onError) { schedulable.ContinueWith(scheduler, onCompleted); TaskChain.Schedule(schedulable.GetRoot(), onError); }
public void Enqueue(TaskChain item) { System.Threading.ThreadPool.QueueUserWorkItem(_ => { if (item == null) { return; } while (true) { var status = item.Next(); if (status != ExecutionStatus.Continue) { break; } } }); }
public static TaskChain Schedule(ISchedulable schedulable, Action <Exception> onError) { var item = new TaskChain { Enumerator = schedulable.Traverse().GetEnumerator(), OnError = onError }; if (item.Enumerator.MoveNext()) { if (item.Enumerator.Current.Scheduler == null) { // default Scheduler.MainThread.Enqueue(item); } else { item.Enumerator.Current.Scheduler.Enqueue(item); } } return(item); }
public void Enqueue(TaskChain item) { var q = GetQueue(); if (q == null) { q = new Queue <TaskChain>(5); q.Enqueue(item); SetQueue(q); try { Trampoline.Run(q); } finally { SetQueue(null); } } else { q.Enqueue(item); } }
public void Enqueue(TaskChain item) { m_queue.Enqueue(item); }