|
OSSIA
Open Scenario System for Interactive Application
|
Calls a function periodically on a strand. More...
Calls a function periodically on a strand.
Once stop() returns, the function is not called any more: stop() raises a flag the handler checks before calling the function and before re-arming, cancels the wait on the strand, and, while the context runs, waits until the strand is past a call in progress. The cancel has to run on the strand: a handler running there re-arms the asio timer, and a cancel from another thread would race with it and miss the new wait. The asio timer and the flag live in a state the handlers share, so a handler that runs late, or after the ossia::timer moved, never reaches freed memory.