Example #1
0
        public void Start <T> (Future <T> future, ISchedulable <T> task, TaskExecutionPolicy executionPolicy)
        {
            using (IsActive)
                task.Schedule(this, future);

            switch (executionPolicy)
            {
            case TaskExecutionPolicy.RunAsBackgroundTask:
                future.RegisterOnResolved(BackgroundTaskOnComplete);
                break;

            default:
                break;
            }
        }
Example #2
0
 private void RegisterOnResolved_Impl <T> (Future <T> f, Delegate onComplete, bool skipQueueOnMainThread = false)
 {
     if (skipQueueOnMainThread)
     {
         var      dict = OnResolvedDispatchersForType_SkipQueue;
         Delegate handler;
         lock (dict)
             dict.TryGetValue(typeof(T), out handler);
         if (handler == null)
         {
             var genMethod = mOnResolvedDispatcher_SkipQueue;
             var method    = genMethod.MakeGenericMethod(typeof(T));
             handler = Delegate.CreateDelegate(typeof(OnFutureResolvedWithData <T>), this, method, true);
             lock (dict)
                 dict[typeof(T)] = handler;
         }
         f.RegisterOnResolved2((OnFutureResolvedWithData <T>)handler, onComplete);
     }
     else
     {
         f.RegisterOnResolved(OnResolvedDispatcher, onComplete);
     }
 }