Scheduler: work retrieval implementation
- simple approach, delegating to Layer-1 - deliberately no error handling - GroomingToken not dropped
This commit is contained in:
parent
b57503fb97
commit
55967cd649
3 changed files with 45 additions and 47 deletions
|
|
@ -145,44 +145,17 @@ namespace gear {
|
|||
Activity*
|
||||
findWork (SchedulerInvocation& layer1, Time now)
|
||||
{
|
||||
layer1.feedPrioritisation();
|
||||
UNIMPLEMENTED("wtf??");
|
||||
while (layer1.isDue (currentSchedulerTime()))
|
||||
if (holdsGroomingToken(std::this_thread::get_id())
|
||||
or acquireGoomingToken())
|
||||
{
|
||||
Activity* activity = layer1.pullHead();
|
||||
if (isInternalWork (activity))
|
||||
performInternalWork (activity);
|
||||
else
|
||||
{
|
||||
performExternalWork (activity);
|
||||
UNIMPLEMENTED("return");
|
||||
}
|
||||
layer1.feedPrioritisation();
|
||||
if (layer1.isDue (now))
|
||||
return layer1.pullHead();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Time
|
||||
currentSchedulerTime() const
|
||||
{
|
||||
UNIMPLEMENTED ("how to manage the current scheduler time");
|
||||
}
|
||||
|
||||
bool
|
||||
isInternalWork (Activity* activity)
|
||||
{
|
||||
UNIMPLEMENTED ("determine if an Activity counts as internal management task");
|
||||
}
|
||||
|
||||
void
|
||||
performInternalWork (Activity* activity)
|
||||
{
|
||||
UNIMPLEMENTED ("evaluate a term");
|
||||
}
|
||||
|
||||
void
|
||||
performExternalWork (Activity* activity)
|
||||
{
|
||||
UNIMPLEMENTED ("drop the exclusion flag and then engage into the external render activity");
|
||||
}
|
||||
|
||||
template<class EXE>
|
||||
activity::Proc
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ namespace test {
|
|||
using lib::time::Time;
|
||||
using std::atomic_bool;
|
||||
using lib::ThreadHookable;
|
||||
using lib::thread::ThreadWrapper;
|
||||
|
||||
using std::unique_ptr;
|
||||
using std::make_unique;
|
||||
using std::this_thread::yield;
|
||||
|
|
@ -202,7 +204,11 @@ namespace test {
|
|||
while (not stopTheHog_);
|
||||
sched.dropGroomingToken();
|
||||
}}
|
||||
.atExit([&]{ groomingHog_.reset(); })
|
||||
.atExit([&](ThreadWrapper& handle)
|
||||
{
|
||||
handle.detach_thread_from_wrapper();
|
||||
groomingHog_.reset();
|
||||
})
|
||||
.threadID("grooming-hog"));
|
||||
sleep_for (500us);
|
||||
}
|
||||
|
|
@ -218,8 +224,8 @@ namespace test {
|
|||
|
||||
|
||||
|
||||
/** @test TODO verify the decision logic where and when
|
||||
* to perform the dispatch of an Scheduler Activity chain.
|
||||
/** @test verify the decision logic where and when to perform
|
||||
* the dispatch of an Scheduler Activity chain.
|
||||
* @todo WIP 10/23 ✔ define ⟶ ✔ implement
|
||||
*/
|
||||
void
|
||||
|
|
@ -267,8 +273,8 @@ namespace test {
|
|||
|
||||
|
||||
|
||||
/** @test TODO verify logic of queue updates and work prioritisation.
|
||||
* @todo WIP 10/23 🔁 define ⟶ implement
|
||||
/** @test verify logic of queue updates and work prioritisation.
|
||||
* @todo WIP 10/23 ✔ define ⟶ ✔ implement
|
||||
*/
|
||||
void
|
||||
verify_findWork()
|
||||
|
|
|
|||
|
|
@ -85018,10 +85018,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697553250983" ID="ID_438556046" MODIFIED="1697553470423" TEXT="doWork ⟼ findWork">
|
||||
<node COLOR="#338800" CREATED="1697553250983" ID="ID_438556046" MODIFIED="1697594581615" TEXT="doWork ⟼ findWork">
|
||||
<linktarget COLOR="#7b8795" DESTINATION="ID_438556046" ENDARROW="Default" ENDINCLINATION="28;-22;" ID="Arrow_ID_520978128" SOURCE="ID_1600142035" STARTARROW="None" STARTINCLINATION="-463;26;"/>
|
||||
<linktarget COLOR="#718daf" DESTINATION="ID_438556046" ENDARROW="Default" ENDINCLINATION="-261;714;" ID="Arrow_ID_1821254034" SOURCE="ID_1076701414" STARTARROW="None" STARTINCLINATION="372;24;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1697560260874" ID="ID_1507199243" MODIFIED="1697560276691" TEXT="versucht das GroomingToken zu erlangen"/>
|
||||
<node CREATED="1697560224719" ID="ID_1707640697" MODIFIED="1697560260107" TEXT="macht die Queue-Updates"/>
|
||||
<node CREATED="1697560285403" ID="ID_1068838996" MODIFIED="1697560290998" TEXT="braucht aktuelle Zeit als Argument"/>
|
||||
|
|
@ -85037,6 +85037,22 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</body>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node CREATED="1697594585841" ID="ID_302244305" MODIFIED="1697594602321" TEXT="falls nichts gefunden..">
|
||||
<node CREATED="1697594603461" ID="ID_1650388592" MODIFIED="1697594606354" TEXT="nullptr"/>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1697594606701" ID="ID_364246048" MODIFIED="1697594671903" TEXT="GroomingToken nicht löschen">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
man könnte es hier auch freigeben; das würde dann aber im Regelfall ein weiteres mal geprüft und freigegeben; zudem haben wir hier auf dieser Ebene auch kein try-catch
|
||||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697553556862" ID="ID_239855477" MODIFIED="1697553563674" TEXT="PostDispatch">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
|
|
@ -85081,14 +85097,14 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
<node COLOR="#435e98" CREATED="1697559664030" ID="ID_406981503" MODIFIED="1697559736138" TEXT="Entscheidung">
|
||||
<icon BUILTIN="yes"/>
|
||||
<node CREATED="1697559679293" ID="ID_91432759" MODIFIED="1697559690783" TEXT="auch Layer-2 ist ein Funktionalitäts-Layer"/>
|
||||
<node CREATED="1697559691347" ID="ID_622772582" MODIFIED="1697559708959" TEXT="der Service wird erst im Scheduler top-Level zusammengestellt"/>
|
||||
<node CREATED="1697559712744" ID="ID_1900900735" MODIFIED="1697559730521" TEXT="dort passiert auch jedwede Dependency-Injection"/>
|
||||
<node CREATED="1697559679293" ID="ID_91432759" MODIFIED="1697594534424" TEXT="auch Layer-2 ist ein Funktionalitäts-Layer"/>
|
||||
<node CREATED="1697559691347" ID="ID_622772582" MODIFIED="1697594534424" TEXT="der Service wird erst im Scheduler top-Level zusammengestellt"/>
|
||||
<node CREATED="1697559712744" ID="ID_1900900735" MODIFIED="1697594534424" TEXT="dort passiert auch jedwede Dependency-Injection"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697553674095" ID="ID_1453351337" MODIFIED="1697583424961" TEXT="decideDispatchNow">
|
||||
<node COLOR="#338800" CREATED="1697553674095" ID="ID_1453351337" MODIFIED="1697594493393" TEXT="decideDispatchNow">
|
||||
<linktarget COLOR="#6d677a" DESTINATION="ID_1453351337" ENDARROW="Default" ENDINCLINATION="3;-38;" ID="Arrow_ID_1868115325" SOURCE="ID_937487663" STARTARROW="None" STARTINCLINATION="-51;3;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1697579158340" ID="ID_793480355" MODIFIED="1697579176584" TEXT="Ausführen ist möglich...">
|
||||
<icon BUILTIN="info"/>
|
||||
<node CREATED="1697579178708" ID="ID_787430790" MODIFIED="1697579237139" TEXT="wenn der Startzeitpunkt nicht in der Zukunft liegt"/>
|
||||
|
|
@ -86262,8 +86278,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1697560535930" ID="ID_849370574" MODIFIED="1697590666428" TEXT="verify_findWork">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1697560535930" ID="ID_849370574" LINK="#ID_438556046" MODIFIED="1697594486097" TEXT="verify_findWork">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1697585964522" ID="ID_1835507068" MODIFIED="1697585970582" TEXT="Szenarien">
|
||||
<icon BUILTIN="list"/>
|
||||
<node COLOR="#435e98" CREATED="1697586050195" ID="ID_1746743909" MODIFIED="1697587479840" TEXT="leere Queue ⟹ nix"/>
|
||||
|
|
@ -86275,6 +86291,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<arrowlink COLOR="#90adb5" DESTINATION="ID_572620103" ENDARROW="Default" ENDINCLINATION="218;11;" ID="Arrow_ID_1616847265" STARTARROW="None" STARTINCLINATION="246;26;"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1697594466088" ID="ID_1087439264" MODIFIED="1697594474623" TEXT="einfache Implementierung: funktioniert">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697560546952" ID="ID_1326942653" MODIFIED="1697560620824" TEXT="verify_postDispatch">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue