Esempio n. 1
0
    //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);
    }
Esempio n. 2
0
 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();
     });
 }