|
Rapicorn - Experimental UI Toolkit - Source Code
13.07.0
|
The QuickTimer class allows fast timer expiration checks from inner loops. More...
Public Member Functions | |
| QuickTimer (uint64 usecs) | |
| Construct a QuickTimer object, suitable to expire after usecs micro seconds. | |
| void | start () |
| Restart the QuickTimer, using the previously set expiration period. | |
| void | start (uint64 usecs) |
| Restart the QuickTimer, setting it to expire after usecs micro seconds. | |
| bool | expired () |
| Perform a very fast check of a global variable for timer expiration. | |
The QuickTimer class allows fast timer expiration checks from inner loops.
On Unix the implementation uses CLOCK_PROCESS_CPUTIME_ID or CLOCK_REALTIME in a concurrent handler which updates a global volatile variable periodically. This allows very fast expiration checks in worker threads, with negligible overhead for most uses.
| bool Rapicorn::QuickTimer::expired | ( | ) | [inline] |
Perform a very fast check of a global variable for timer expiration.
Usually, this function is inlined and does not consume more time than a regular volatile variable access, which means it's ideally suited to check for time period expiration from inside inner loops.
1.7.6.1