Don't set a thread priority if real-time isn't requested
This commit is contained in:
parent
dd74757319
commit
f3ac3cd1e2
@ -235,28 +235,20 @@ void al_print(const char *fname, unsigned int line, const char *fmt, ...)
|
||||
|
||||
void SetRTPriority(void)
|
||||
{
|
||||
ALboolean failed;
|
||||
ALboolean failed = AL_FALSE;
|
||||
|
||||
#ifdef _WIN32
|
||||
if(RTPrioLevel > 0)
|
||||
failed = !SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||
else
|
||||
failed = !SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
|
||||
#elif defined(HAVE_PTHREAD_SETSCHEDPARAM) && !defined(__OpenBSD__)
|
||||
struct sched_param param;
|
||||
|
||||
if(RTPrioLevel > 0)
|
||||
{
|
||||
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);
|
||||
failed = !!pthread_setschedparam(pthread_self(), SCHED_RR, ¶m);
|
||||
}
|
||||
else
|
||||
{
|
||||
param.sched_priority = 0;
|
||||
failed = !!pthread_setschedparam(pthread_self(), SCHED_OTHER, ¶m);
|
||||
}
|
||||
#else
|
||||
/* Real-time priority not available */
|
||||
failed = (RTPrioLevel>0);
|
||||
|
Loading…
Reference in New Issue
Block a user