Example #1
0
        internal OperationsQueue()
        {
            resultObs = queuedOps
                        .Select(operation =>
                                // Defer Processing of the operation until subscribed to
                                Observable.Defer(() => operation.EvaluateFunc().ToObservable()))
                        .Concat()
                        .Multicast(new Subject <Unit>());

            resultObs.Connect();

            dispose = new Lazy <Task>(() =>
            {
                queuedOps.OnCompleted();
                return(resultObs.LastOrDefaultAsync().ToTask());
            }, LazyThreadSafetyMode.ExecutionAndPublication);
        }