Helper class for Windows Multimedia Scheduler Service (MMCSS) thread elevation. More...
#include <AvSetMmThreadOptions.hpp>
Public Member Functions | |
| auto | av_set () -> void |
| Elevates the calling thread to the MMCSS "Pro Audio" task. | |
| auto | av_revert () -> void |
| Reverts the calling thread's MMCSS scheduling characteristics. | |
Helper class for Windows Multimedia Scheduler Service (MMCSS) thread elevation.
On call to av_set, registers the calling thread with the MMCSS "Pro Audio" task and sets its priority to AVRT_PRIORITY_HIGH via AvSetMmThreadCharacteristics and AvSetMmThreadPriority. On call to av_revert, reverts the thread's scheduling characteristics via AvRevertMmThreadCharacteristics.
MMCSS elevation reduces the likelihood that the Windows scheduler preempts the timer loop thread in favour of lower-priority background work, which in turn reduces jitter in the period at which Timer::wait()'s callback is invoked.
This struct is constructed as a local variable at the top of Timer::wait() so that MMCSS eleveation covers the entire loop and is automatically reverted when wait() returns, regardless of whether it returns normally or via an exception.
Timer. User code should not construct it directly.Definition at line 27 of file AvSetMmThreadOptions.hpp.
|
inline |
Elevates the calling thread to the MMCSS "Pro Audio" task.
Calls AvSetMmThreadCharacteristics to register the thread via MMCSS, then calls AvSetMmThreadPriority to raise its scheduling priority within the task.
AvSetMmThreadCharacteristics fails it returns NULL; no exception is thrown in the current implementation. Definition at line 37 of file AvSetMmThreadOptions.hpp.
|
inline |
Reverts the calling thread's MMCSS scheduling characteristics.
Calls AvRevertMmThreadCharacteristics to de-register the thread from the MMCSS "Pro Audio" task, restoring its normal scheduling behaviour.
Definition at line 50 of file AvSetMmThreadOptions.hpp.