Lumiera  0.pre.03
»edit your freedom«
DispatcherLoop Class Reference

Description

PImpl within SteamDispatcher to implement the Session Loop Thread. During the lifetime of this object...

  • the SessionCommandService is offered to enqueue commands
  • the Session Loop thread dispatches commands and triggers the Builder
    See also
    DispatcherLooper_test

Definition at line 119 of file steam-dispatcher.cpp.

Public Member Functions

template<typename FUN >
 DispatcherLoop (FUN &&atExit)
 start the session loop thread More...
 
void activateCommandProecssing ()
 
void awaitStateProcessed () const
 
void clear () override
 
void deactivateCommandProecssing ()
 
void enqueue (Command &&cmd) override
 
void requestStop () noexcept
 
size_t size () const
 
- Public Member Functions inherited from CommandDispatch
virtual ~CommandDispatch ()
 this is an interface
 

Private Types

using Launch = lib::ThreadHookable::Launch
 
using ServiceHandle = lib::DependInject< SessionCommandService >::ServiceInstance<>
 

Private Member Functions

void awaitAction ()
 
bool isStateSynched () const
 
void processCommands ()
 
void runSessionThread ()
 any operation running in the Session thread is started from here. More...
 
void startBuilder ()
 
void updateState ()
 

Private Attributes

ServiceHandle commandService_
 manage the primary public Session interface
 
string error_
 
SyncBarrier init_
 
Looper looper_
 
CommandQueue queue_
 
ThreadHookable thread_
 

Additional Inherited Members

- Static Public Member Functions inherited from Sync< RecursiveLock_Waitable >
static MonitorgetMonitor (Sync const *forThis)
 

Constructor & Destructor Documentation

◆ DispatcherLoop()

DispatcherLoop ( FUN &&  atExit)
inline

start the session loop thread

Parameters
notificationcallback to invoke on thread termination
Remarks
in theory this ctor could block, since it waits for the thread actually to get operational and it waits for the SessionCommand interface to be opened. The latter better should not run into any obstacles, because in case it does, the main application thread will be deadlocked on startup. Such might happen indirectly, when something depends on "the Session"

Definition at line 145 of file steam-dispatcher.cpp.

References ThreadWrapper::detach_thread_from_wrapper(), ERROR_LOG_AND_IGNORE, and DispatcherLoop::runSessionThread().

+ Here is the call graph for this function:

Member Function Documentation

◆ runSessionThread()

void runSessionThread ( )
inlineprivate

any operation running in the Session thread is started from here.

When this loop terminates, the »session subsystem« shuts down.

Note
the callback notifyEnd is typically bound to invoke SteamDispatcher::endRunningLoopState().

Definition at line 251 of file steam-dispatcher.cpp.

References cStr(), Looper::hasPendingChanges(), SteamDispatcher::instance, ThreadWrapper::invokedWithinThread(), lumiera_error(), Looper::markStateProcessed(), Looper::requireAction(), and Looper::shallLoop().

Referenced by DispatcherLoop::DispatcherLoop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
+ Inheritance diagram for DispatcherLoop:
+ Collaboration diagram for DispatcherLoop:

The documentation for this class was generated from the following file: