diff --git a/src/vault/gear/activity.hpp b/src/vault/gear/activity.hpp index 9c88e1306..1f74e1174 100644 --- a/src/vault/gear/activity.hpp +++ b/src/vault/gear/activity.hpp @@ -604,7 +604,7 @@ namespace gear { activity::Proc Activity::activate (Time now, EXE& executionCtx) { - activity::_verify_usable_as_ExecutionContext(); +// activity::_verify_usable_as_ExecutionContext(); switch (verb_) { case INVOKE: @@ -651,7 +651,7 @@ namespace gear { activity::Proc Activity::dispatch (Time now, EXE& executionCtx) { - activity::_verify_usable_as_ExecutionContext(); +// activity::_verify_usable_as_ExecutionContext(); switch (verb_) { case NOTIFY: @@ -681,7 +681,7 @@ namespace gear { activity::Proc Activity::notify (Time now, EXE& executionCtx) { - activity::_verify_usable_as_ExecutionContext(); +// activity::_verify_usable_as_ExecutionContext(); switch (verb_) { case GATE: diff --git a/src/vault/gear/scheduler.hpp b/src/vault/gear/scheduler.hpp index ebd80adf0..201103b39 100644 --- a/src/vault/gear/scheduler.hpp +++ b/src/vault/gear/scheduler.hpp @@ -65,8 +65,9 @@ namespace gear { namespace { // Scheduler default config - const auto IDLE_WAIT = 20ms; - const size_t DISMISS_CYCLES = 100; + const auto IDLE_WAIT = 20ms; ///< sleep-recheck cycle for workers deemed _idle_ + const size_t DISMISS_CYCLES = 100; ///< number of wait cycles before an idle worker terminates completely + Offset POLL_WAIT_DELAY{FSecs(1,1000)}; ///< delay until re-evaluating a condition previously found unsatisfied } @@ -166,9 +167,73 @@ namespace gear { { UNIMPLEMENTED("die harder"); } + + + /** @internal expose a binding for Activity execution */ + class ExecutionCtx; }; + /** + * @remark when due, the scheduled Activities are performed within the + * [Activity-Language execution environment](\ref ActivityLang::dispatchChain()); + * some aspects of Activity _activation_ however require external functionality, + * which — for the purpose of language definition — was abstracted as _Execution-context._ + * The implementation of these binding functions fills in relevant external effects and + * is in fact supplied by the implementation internals of the scheduler itself. + */ + class Scheduler::ExecutionCtx + : private Scheduler + { + public: + static ExecutionCtx& + from (Scheduler& self) + { + return static_cast (self); + } + + /* ==== Implementation of the Concept ExecutionCtx ==== */ + + /** λ-post: */ + activity::Proc + post (Time when, Activity& chain, ExecutionCtx& ctx) + { + return layer2_.postDispatch (&chain, when, ctx, layer1_); + } + + void + work (Time, size_t) + { + UNIMPLEMENTED ("λ-work"); + } + + void + done (Time, size_t) + { + UNIMPLEMENTED ("λ-done"); + } + + activity::Proc + tick (Time) + { + UNIMPLEMENTED ("λ-tick"); + } + + Offset + getWaitDelay() + { + return POLL_WAIT_DELAY; + } + + Time + getSchedTime() + { + UNIMPLEMENTED ("access scheduler Time"); + } + }; + + + }} // namespace vault::gear #endif /*SRC_VAULT_GEAR_SCHEDULER_H_*/ diff --git a/tests/vault/gear/activity-detector.hpp b/tests/vault/gear/activity-detector.hpp index 3310a0c97..cce360848 100644 --- a/tests/vault/gear/activity-detector.hpp +++ b/tests/vault/gear/activity-detector.hpp @@ -119,7 +119,7 @@ namespace test { const string CTX_DONE{"CTX-done"}; const string CTX_TICK{"CTX-tick"}; - Offset POLL_DELAY{FSecs(1)}; + Offset POLL_WAIT_DELAY{FSecs(1)}; Time SCHED_TIME_MARKER{555,5}; ///< marker value for "current scheduler time" used in tests } @@ -563,7 +563,7 @@ namespace test { _DiagnosticFun::Type done; _DiagnosticFun::Type tick; - function getWaitDelay = [] { return POLL_DELAY; }; + function getWaitDelay = [] { return POLL_WAIT_DELAY; }; function getSchedTime = [this]{ return SCHED_TIME_MARKER;}; FakeExecutionCtx (ActivityDetector& detector) diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index d85580a0b..960b40ee6 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -80285,9 +80285,55 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + +

+ ...also solange ich nur mit Unit-Tests gearbeitet habe +

+ + +
+
+
+ + + + + + + + + + + + +

+ im Besonderen λ-post ist im Grunde +

+

+ der Scheduler-Service überhaupt +

+ + +
+ + + + + +

+ ...nämlich die Fähigkeit, einen Activity-chain zu einem geplanten Zeitpunkt oder auf Signal hin auszuführen — und diese Fähigkeit muß selbstverständlich der Sprache selber zu Gebote stehen, damit sie komplexe Aktionsmuster flexibel ausdrücken kann +

+ + +
- - @@ -81817,6 +81863,67 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + +

+ es genügte, an diesen Stellen die Ausführung der abstrahierten Aktionen zu loggen +

+ + +
+
+ + + + + + + + + + + + + +

+ ⟹ der Scheduler selber kann diese Rolle generisch übernehmen +

+ + +
+
+ + + + + + +
    +
  • + eine Subklasse, die aber private vom Scheduler erbt +
  • +
  • + sie bietet selber eine Downcast-Accessor-Funktion +
  • +
  • + eigene Datenfelder sind nicht erlaubt (Slicing) +
  • +
  • + aber beliebige Member-Funktionen, die sich frei aus dem (protected)-Scope des Schedulers bedienen können +
  • +
+ +
+
+
+
@@ -86787,6 +86894,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + +