/// <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); }
internal void EnqueueQuery(IFuture future, Action executeFunc) { lock (this) if (!_Closing) { QueueWorkItem(new PendingQuery(executeFunc, future)); return; } future.SetResult(null, new ConnectionDisposedException()); }
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(); } }
public static void Fail(this IFuture future, Exception error) { future.SetResult(null, error); }
public static void Complete(this IFuture future, object result) { future.SetResult(result, null); }
public static void Complete(this IFuture future) { future.SetResult(null, null); }