diff --git a/src/vault/gear/activity.hpp b/src/vault/gear/activity.hpp index 9a53e7060..c4273f4f9 100644 --- a/src/vault/gear/activity.hpp +++ b/src/vault/gear/activity.hpp @@ -169,6 +169,7 @@ namespace gear { ASSERT_MEMBER_FUNCTOR (EXE::work, void(Time, size_t)); ASSERT_MEMBER_FUNCTOR (EXE::done, void(Time, size_t)); ASSERT_MEMBER_FUNCTOR (EXE::tick, Proc(Time)); + ASSERT_MEMBER_FUNCTOR (EXE::spin, Time(Time)); #undef ASSERT_MEMBER_FUNCTOR @@ -441,8 +442,13 @@ namespace gear { activity::Proc checkGate (Time now, EXE& executionCtx) { - UNIMPLEMENTED ("evaluate GATE condition and branch accordingly"); - return executionCtx.post (now, *next, executionCtx); + REQUIRE (GATE == verb_); + if (now > data_.condition.dead) // beyond deadline + return activity::SKIP; + if (0 < data_.condition.rest) // prerequisite count not(yet) fulfilled -> spin (=re-invoke later) + return executionCtx.post (executionCtx.spin(now), *this, executionCtx); + else + return activity::PASS; } template diff --git a/tests/vault/gear/activity-detector-test.cpp b/tests/vault/gear/activity-detector-test.cpp index 0d64687cd..dd6d8b990 100644 --- a/tests/vault/gear/activity-detector-test.cpp +++ b/tests/vault/gear/activity-detector-test.cpp @@ -336,8 +336,15 @@ namespace test { - /** @test TODO diagnostic setup to watch Activity::GATE activation - * @todo WIP 7/23 🔁 define ⟶ implement + /** @test diagnostic setup to watch Activity::GATE activation + * - when applied, Tap will be inserted before and after the + * instrumented GATE-Activity + * - it can thus be traced when the Gate is activated, + * but also when the Gate condition is met and the `next` + * Activity after the Gate is activated + * - for this unit-test, a Gate and a follow-up Activity + * is invoked directly, to verify the generated log entries + * @todo WIP 7/23 ✔ define ✔ implement */ void watch_gate() @@ -353,8 +360,13 @@ namespace test { Time tt{5,5}; wiring->activate(tt, detector.executionCtx); + ++detector; + wiring->next->activate(tt, detector.executionCtx); - cout<::Type done; _DiagnosticFun::Type tick; + static Time spin (Time now) { return now + SPIN_DELAY; } + FakeExecutionCtx (ActivityDetector& adi) : post{adi.buildDiagnosticFun(CTX_POST).returning(activity::PASS)} , work{adi.buildDiagnosticFun(CTX_WORK)} diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 0b3d24fbf..1836e0d16 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -77840,7 +77840,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -78447,6 +78447,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + @@ -78649,23 +78652,23 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - - + + - + - - - - + + + + - - + + - - + + @@ -81666,10 +81669,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + @@ -81763,6 +81766,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + +
@@ -82059,6 +82065,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + @@ -82284,14 +82294,17 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - - + + + + + @@ -82303,8 +82316,16 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + + + +

+ passende ID hierfür vergeben: afterGATE +

+ +
+