MACRO
OMNI_SLEEP1 - A helper macro for millisecond sleeps
DESCRIPTION top
To enable millisecond sleep capabilities cross-platform, temporaries are needed on non-Windows platforms; to this, when
Example:
In this example,
To enable millisecond sleep capabilities cross-platform, temporaries are needed on non-Windows platforms; to this, when
omni::sync::sleep is called, this macro is utilized. As well, in other areas of the framework where a sleep is called in a tight loop, this macro is utilized.Example:
OMNI_SLEEP_INIT(); while (dorun) { OMNI_SLEEP1(); // ~1ms sleep }
OMNI_SLEEP_INIT is an empty macro on Windows platforms and the sleep variables needed on others and OMNI_SLEEP expands to the Windows Sleep function and the nanosleep function on others to achieve millisecond sleep resolution.
CONSIDERATIONS top
While the sleep specified is meant for 1ms sleep, it can be typical for a sleep to take approximately 10-15ms due to time slicing and kernel timing. So a 1ms sleep might be 1ms, 10ms or even 0 (i.e. no sleep).
While the sleep specified is meant for 1ms sleep, it can be typical for a sleep to take approximately 10-15ms due to time slicing and kernel timing. So a 1ms sleep might be 1ms, 10ms or even 0 (i.e. no sleep).
PLATFORM SPECIFIC top
OMNI_SLEEP expands to the Windows Sleep API and the nanosleep function on others to achieve millisecond sleep resolution.