コード例 #1
0
        /// <summary>
        /// Causes this future to become completed when the specified future is completed.
        /// </summary>
        public static void Bind(this IFuture future, IFuture target)
        {
            OnComplete handler = (f) => {
                object    result;
                Exception error;
                f.GetResult(out result, out error);
                future.SetResult(result, error);
            };

            target.RegisterOnComplete(handler);
        }
コード例 #2
0
        internal void EnqueueQuery(IFuture future, Action executeFunc)
        {
            lock (this)
                if (!_Closing)
                {
                    QueueWorkItem(new PendingQuery(executeFunc, future));

                    return;
                }

            future.SetResult(null, new ConnectionDisposedException());
        }
コード例 #3
0
ファイル: Util.cs プロジェクト: jli94/Fracture
        protected void Resume()
        {
            OnEarlyDispose = null;

            if (_ResumeFuture != null)
            {
                int count;
                lock (_Buffer)
                    count = _Buffer.Count;

                _ResumeFuture.SetResult((count > 0), null);
                _ResumeFuture = null;

                if (count == 0)
                {
                    Dispose();
                }
            }
            else
            {
                Dispose();
            }
        }
コード例 #4
0
 public static void Fail(this IFuture future, Exception error)
 {
     future.SetResult(null, error);
 }
コード例 #5
0
 public static void Complete(this IFuture future, object result)
 {
     future.SetResult(result, null);
 }
コード例 #6
0
 public static void Complete(this IFuture future)
 {
     future.SetResult(null, null);
 }