Example #1
0
            public Logic(BackpressureTimeout <T> stage) : base(stage.Shape)
            {
                _stage        = stage;
                _nextDeadline = DateTime.UtcNow.Ticks + stage.Timeout.Ticks;

                SetHandler(stage.Inlet, this);
                SetHandler(stage.Outlet, this);
            }
Example #2
0
            public Logic(BackpressureTimeout <T> stage) : base(stage.Shape)
            {
                _stage        = stage;
                _nextDeadline = DateTime.UtcNow.Ticks + stage.Timeout.Ticks;

                SetHandler(stage.Inlet, onPush: () =>
                {
                    Push(stage.Outlet, Grab(stage.Inlet));
                    _nextDeadline  = DateTime.UtcNow.Ticks + stage.Timeout.Ticks;
                    _waitingDemand = true;
                });
                SetHandler(stage.Outlet, onPull: () =>
                {
                    _waitingDemand = false;
                    Pull(stage.Inlet);
                });
            }