コード例 #1
0
ファイル: GraphStages.cs プロジェクト: marcpiechura/akka.net
            public Logic(TerminationWatcher <T> stage, TaskCompletionSource <NotUsed> finishPromise) : base(stage.Shape)
            {
                _stage         = stage;
                _finishPromise = finishPromise;

                SetHandler(stage._inlet, stage._outlet, this);
            }
コード例 #2
0
            public Logic(TerminationWatcher <T> watcher, TaskCompletionSource <NotUsed> finishPromise) : base(watcher.Shape)
            {
                SetHandler(watcher._inlet, onPush: () => Push(watcher._outlet, Grab(watcher._inlet)), onUpstreamFinish: () =>
                {
                    finishPromise.TrySetResult(NotUsed.Instance);
                    CompleteStage();
                }, onUpstreamFailure: ex =>
                {
                    finishPromise.TrySetException(ex);
                    FailStage(ex);
                });

                SetHandler(watcher._outlet, onPull: () => Pull(watcher._inlet), onDownstreamFinish: () =>
                {
                    finishPromise.TrySetResult(NotUsed.Instance);
                    CompleteStage();
                });
            }