![]() |
Open Lighting Architecture 0.10.9
|
Defer execution of a callback.
The executor interface provides a method to defer execution of a callback. Often we want to break the call stack, say if we need to run a callback that modify / delete a non-reentrant object in our call stack.
Public Member Functions | |
| virtual void | Execute (ola::BaseCallback0< void > *callback)=0 |
| Execute the supplied callback at some point in the future. | |
| virtual void | DrainCallbacks ()=0 |
| Run all callbacks until there are none left. | |
|
pure virtual |
Run all callbacks until there are none left.
Implemented in ola::client::SelectServer, ola::io::SelectServer, ola::plugin::karate::PluginAdaptor, ola::plugin::opendmx::PluginAdaptor, ola::PluginAdaptor, ola::SelectServer, ola::thread::ExecutorThread, ola::thread::SelectServer, and SelectServer.
|
pure virtual |
Execute the supplied callback at some point in the future.
| callback | the callback to run. |
This method provides the following guarantees:
When queuing callbacks, you need to ensure that either:
To achieve the latter it's common to keep track of the number of outstanding callbacks and then call DrainCallbacks() in the destructor if the number of outstanding callbacks is non-0.
Implemented in ola::client::SelectServer, ola::io::SelectServer, ola::plugin::karate::PluginAdaptor, ola::plugin::opendmx::PluginAdaptor, ola::PluginAdaptor, ola::SelectServer, ola::thread::ExecutorThread, ola::thread::SelectServer, and SelectServer.