Thread that calls a function periodically.
More...
#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/system/al_PeriodicThread.hpp>
|
static void * | current () |
| Return pointer to current OS thread object. More...
|
|
Thread that calls a function periodically.
The sleep time is dynamically adjusted based on the time taken by the user-supplied thread function. This prevents drift that would occur in a more simplistic implementation using a fixed sleep interval.
Definition at line 61 of file al_PeriodicThread.hpp.
◆ PeriodicThread()
al::PeriodicThread::PeriodicThread |
( |
double |
periodSec = 1 | ) |
|
- Parameters
-
[in] | periodSec | calling period in seconds |
[in] | oneShot | determines if the timer triggers only once. |
[in] | triggerOnStart | if true, calling start() calls the function, otherwise function is called on next timeout |
◆ autocorrect()
Set autocorrection factor.
This parameter is used to compensate for occasional iterations that take longer than the expected iteration period. Smaller values mean the timing corrections will be spread over a larger number of iterations. If all iterations take longer than the period, then no autocorrection measures will be able to make up for the lost time.
- Parameters
-
[in] | factor | Maximum fraction of one period, in [0,1], to try to make up each iteration if behind on timing. |
◆ current()
static void* al::Thread::current |
( |
| ) |
|
|
staticinherited |
Return pointer to current OS thread object.
E.g., if using pthreads internally, will return the pthread_t.
◆ join()
bool al::Thread::join |
( |
| ) |
|
|
inherited |
Block the calling routine indefinitely until the thread terminates.
This function suspends execution of the calling routine until the thread has terminated. It will return immediately if the thread was already terminated. A true return value signifies successful termination. A false return value indicates a problem with the wait call.
◆ priority()
Thread& al::Thread::priority |
( |
int |
v | ) |
|
|
inherited |
Set thread priority.
- Parameters
-
[in] | v | priority of thread in [0, 99]. A value greater than 0 makes the thread "real-time". |
The documentation for this class was generated from the following file: