DispatcherLoop: add wake-up notification on state change
This commit is contained in:
parent
f26ef5230c
commit
3915e3230e
3 changed files with 16 additions and 9 deletions
|
|
@ -71,10 +71,9 @@
|
|||
** @note most of the time, the Session Loop Thread does not hold any lock, most notably while performing
|
||||
** a command or running the builder. Likewise, evaluation of the control logic in the Looper helper
|
||||
** is a private detail of the performing thread. The lock is acquired solely for checking or leaving
|
||||
** the wait state and when fetching next command from queue.
|
||||
** the wait state and when fetching the next command from queue.
|
||||
**
|
||||
** @todo as of 12/2016, implementation has been drafted and is very much WIP
|
||||
** @todo //////////////////////////////////////////////////////TODO ensure really every state change triggers a wakeup!!!!!!!
|
||||
**
|
||||
** @see ProcDispatcher
|
||||
** @see DispatcherLooper_test
|
||||
|
|
@ -182,12 +181,11 @@ namespace control {
|
|||
Lock sync(this);
|
||||
commandService_.reset(); // closes Session interface
|
||||
looper_.triggerShutdown();
|
||||
UNIMPLEMENTED("*must* notify loop thread"); /////////////////TODO really? YES!!!
|
||||
//////////////////////////////////////////TODO notify!!!!
|
||||
sync.notifyAll();
|
||||
}
|
||||
|
||||
void
|
||||
awaitStateProcessed()
|
||||
awaitStateProcessed() const
|
||||
{
|
||||
Lock blockWaiting(this, &DispatcherLoop::stateIsSynched);
|
||||
//////////////////////////////////////////TODO eternal sleep.... find out who will wake us!!!!
|
||||
|
|
@ -202,14 +200,13 @@ namespace control {
|
|||
|
||||
|
||||
/* === CommandDispatch interface === */
|
||||
//////////////////////////////////////////TODO notify!!!! on!! every!! state!! changing!! operation!!
|
||||
|
||||
void
|
||||
enqueue (Command cmd) override
|
||||
{
|
||||
Lock sync(this);
|
||||
queue_.feed (cmd);
|
||||
//////////////////////////////////////////TODO notify!!!!
|
||||
sync.notifyAll();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -217,7 +214,7 @@ namespace control {
|
|||
{
|
||||
Lock sync(this);
|
||||
queue_.clear();
|
||||
//////////////////////////////////////////TODO notify!!!!
|
||||
sync.notifyAll();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -174,6 +174,14 @@ namespace test {
|
|||
CHECK (not looper.isWorking());
|
||||
CHECK ( looper.isIdle());
|
||||
CHECK (looper.shallLoop());
|
||||
|
||||
looper.triggerShutdown();
|
||||
|
||||
CHECK (not looper.shallLoop());
|
||||
|
||||
CHECK ( looper.requireAction());
|
||||
CHECK (not looper.isWorking());
|
||||
CHECK (not looper.isIdle());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -452,7 +452,9 @@
|
|||
<node CREATED="1483642220941" ID="ID_775655275" MODIFIED="1483645257684" TEXT="integrate actual command queue">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1483642220941" ID="ID_704571897" MODIFIED="1483642220941" TEXT="care for waking (notification) from sleep state"/>
|
||||
<node CREATED="1483642220941" ID="ID_704571897" MODIFIED="1483648766529" TEXT="care for waking (notification) from sleep state">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1483642220940" ID="ID_1519554797" MODIFIED="1483642272822" TEXT="care for syncing the disabled state"/>
|
||||
<node CREATED="1483642220941" ID="ID_377776032" MODIFIED="1483642220941" TEXT="deadlock safeguard"/>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue