Esempio n. 1
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);
     }
 }