diff --git a/src/lib/sync.hpp b/src/lib/sync.hpp index 819ad2a97..c709aeec1 100644 --- a/src/lib/sync.hpp +++ b/src/lib/sync.hpp @@ -474,7 +474,10 @@ namespace lib { /** convenience shortcut: * Locks and immediately enters wait state, - * observing a condition defined as member function. */ + * observing a condition defined as member function. + * @deprecated WARNING this function is not correct! ////////////////////////////TICKET #1051 + * Lock is not released on error from within wait() + */ template Lock(X* it, bool (X::*method)(void)) : mon_(getMonitor(it)) diff --git a/src/lib/thread.hpp b/src/lib/thread.hpp index e4a8cf436..e136df862 100644 --- a/src/lib/thread.hpp +++ b/src/lib/thread.hpp @@ -224,7 +224,7 @@ namespace lib { using BAS::BAS; /** Wrapper to capture a success/failure indicator and possibly a computation result */ - lib::Result result_{error::Logic{"Thread still running; need to join() first."}}; + lib::Result result_{error::Logic{"No result yet, thread still running; need to join() first."}}; template diff --git a/src/steam/control/steam-dispatcher.cpp b/src/steam/control/steam-dispatcher.cpp index 79c3f7f0e..79970256c 100644 --- a/src/steam/control/steam-dispatcher.cpp +++ b/src/steam/control/steam-dispatcher.cpp @@ -195,7 +195,8 @@ namespace control { void awaitStateProcessed() const { - Lock blockWaiting(unConst(this), &DispatcherLoop::isStateSynched); ///////////////////////TICKET #1057 : const correctness on wait predicate + Lock(unConst(this)).wait(unConst(*this), &DispatcherLoop::isStateSynched); ///////////////////////TICKET #1051 : support bool-λ and fix the correctness-error in the »convenience shortcut« + ////////////////////////TICKET #1057 : const correctness on wait predicate // wake-up typically by updateState() } diff --git a/tests/core/steam/control/session-command-function-test.cpp b/tests/core/steam/control/session-command-function-test.cpp index 0ce533a33..ea0b4ad12 100644 --- a/tests/core/steam/control/session-command-function-test.cpp +++ b/tests/core/steam/control/session-command-function-test.cpp @@ -351,7 +351,7 @@ namespace test { public: InvocationProducer (SyncBarrier& trigger) : barrier_{trigger} - , thread_{"command producer", [&]{ fabricateCommands(); }} + , thread_{"producer", [&]{ fabricateCommands(); }} { } ~InvocationProducer() @@ -391,7 +391,6 @@ namespace test { }; /* == controlling code in main thread == */ - try{ Time prevState = testCommandState; FSecs expectedOffset{0}; @@ -424,19 +423,6 @@ namespace test { __DELAY__ CHECK (testCommandState - prevState == Time(expectedOffset)); - } - catch(lumiera::Error& ex) - { - cout << "##### Lumix-Ex: "< - + + @@ -80569,18 +80570,287 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + + + + + + + + +

+ aber hier schläft der Dispatcher-Thrad gar nicht — sondern wartet auf das Lock +

+ +
+
- + + - - + + + + + + + + + + +

+ ⟹ der Test-Controller-Thread kommt gar nicht dazu, +

+

+ auf das Ende der Worker zu warten +

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

+ ein verschleppter Error-State +

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

+ ...und zwar an der einzigen Stelle, an der das zuverlässig möglich ist: im Konstruktur von Exceptions +

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

+ Debugger ⟹ Lock-Guard-Destruktor wird nicht aufgerufen +

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

+ die Exception fliegt ja aus dem Konstruktor vom Guard +

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

+ (ja dann KANNs ja gar nicht funktionieren) +

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

+ das Problem ist entstanden weil der Monitor „vorsorglich“ den Error-State auswertet, +

+

+ dann aber nicht klar ist, wie mit einer solchen Situation umzugehen ist. +

+

+ Des weiteren ist nicht klar, was die Kopplung zwischen Exception und Error-State soll +

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

+ die Gleichwertigkeit von Error-Flag und Exception wird nun in Frage gestellt +

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

+ Plan: künftig sollen Error-Flags nur noch aus C-Code stammen +

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

+ solange ich nur Detail-Komponenten gebaut habe, konnte ich von komplett definiertem Kontext (Unit-Test) ausgehen; damit waren Exceptions vor allem etwas, was man pro forma noch mit einbaut, aber letztlich nur „über die Mauer wirft“ +

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

+ die verschleppte Exception ist aber nur der Anlaß +

+ + +
+
+ + + + + + +

+ der Grund ist ein Bug im Objekt-Monitor +

+ + +
+ + + + + + + + +
@@ -80634,6 +80904,12 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + @@ -91915,12 +92191,16 @@ class Something - - + + + + + +