Rapicorn - Experimental UI Toolkit - Source Code  13.07.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Member Functions
Rapicorn::QuickTimer Class Reference

The QuickTimer class allows fast timer expiration checks from inner loops. More...

List of all members.

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.

Detailed Description

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.


Member Function Documentation

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.

Returns:
Whether the time period that QuickTimer was setup for has expired.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines