ark::concurrency::CallbackThread
Defined in header “ark/concurrency/callback_thread.hh”.
This class allows you to create a backing thread that will process commands. It is useful for when you have code where all commands need to execute from the same thread context.
Methods
-
CallbackThread(std::string name)
Constructor. Initializes the callback thread with the given name. -
~CallbackThread()
Destructor. When the thread is destroyed, existing execute() calls will return (near) instantly, and the work they were executing is in an undefined state (may or may not have been executed). It is advisable to ensure all work is completed before destroying the thread (in other words, that this thread doesn’t fall out of scope during a call to execute()). -
void execute(std::function< void()> callback)
Executes the given command. This call will block until the command has completed successfully. See comments on the destructor for caveats during thread teardown.