diff options
author | Chris Robinson <[email protected]> | 2009-11-29 23:02:21 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-11-29 23:02:21 -0800 |
commit | f63d8dbf38352b9ca0f1dc5e8eab87242c81b3ee (patch) | |
tree | 40c78b4d5fabe9a170c7b1e6a789b21766cba352 /OpenAL32/Include/alMain.h | |
parent | 15aad09ce73e1a71837579be96348c8708c127ea (diff) |
Enable real-time priority for ALSA, OSS, and DirectSound mixing loops
Diffstat (limited to 'OpenAL32/Include/alMain.h')
-rw-r--r-- | OpenAL32/Include/alMain.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index e235794a..0820b9dc 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -181,6 +181,22 @@ static __inline ALuint NextPowerOf2(ALuint value) return powerOf2; } +static __inline void EnableRTPrio() +{ +#ifdef _WIN32 + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); +#elif defined(HAVE_PTHREAD_SETSCHEDPARAM) + struct sched_param param; + + /* Use the minimum real-time priority possible for now (on Linux this + * should be 1 for SCHED_RR) */ + param.sched_priority = sched_get_priority_min(SCHED_RR); + pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); +#else + /* Real-time priority not available */ +#endif +} + typedef struct { ALCboolean (*OpenPlayback)(ALCdevice*, const ALCchar*); |