//public AsyncQueue<T> Then(Action<T> callback) //{ // base.Then(new Action<object>(o => callback((T)o))); //return this; //} public void Add(AsyncReply <T> reply) { lock (queueLock) list.Add(reply); resultReady = false; reply.Then(processQueue); }
public AsyncAwaiter(AsyncReply <T> reply) { reply.Then(x => { this.IsCompleted = true; this.result = (T)x; this.callback?.Invoke(); }).Error(x => { exception = x; this.IsCompleted = true; this.callback?.Invoke(); }); }