mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
be able to set thread priority
This commit is contained in:
parent
227434c5c3
commit
56d040d3cc
@ -164,7 +164,24 @@ void AudioManager::ns_spawn_update(void) {
|
||||
if (_quit == (bool*)0L)
|
||||
_quit = new bool(false);
|
||||
*_quit = false;
|
||||
_spawned = thread::create(spawned_update, _quit, thread::PRIORITY_LOW);
|
||||
thread::priority_t pri;
|
||||
switch (audio_thread_priority) {
|
||||
case 0:
|
||||
pri = thread::PRIORITY_LOW;
|
||||
break;
|
||||
case 1:
|
||||
pri = thread::PRIORITY_NORMAL;
|
||||
break;
|
||||
case 2:
|
||||
pri = thread::PRIORITY_HIGH;
|
||||
break;
|
||||
default:
|
||||
audio_cat->error() << "audio-thread-priority set to something other "
|
||||
<< "then low, normal, or high" << endl;
|
||||
audio_thread_priority = 1;
|
||||
pri = thread::PRIORITY_NORMAL;
|
||||
}
|
||||
_spawned = thread::create(spawned_update, _quit, pri);
|
||||
} else {
|
||||
audio_cat->error() << "tried to spawn 2 update threads" << endl;
|
||||
}
|
||||
|
@ -46,6 +46,18 @@ ConfigureFn(config_audio) {
|
||||
|
||||
audio_device = new string(config_audio.GetString("audio-device",
|
||||
"/dev/dsp"));
|
||||
|
||||
string stmp = config_audio.GetString("audio-thread-priority", "NORMAL");
|
||||
for (string::iterator q=stmp.begin(); q!=stmp.end(); ++q)
|
||||
(*q) = toupper(*q);
|
||||
if (stmp == "LOW")
|
||||
audio_thread_priority = 0;
|
||||
else if (stmp == "NORMAL")
|
||||
audio_thread_priority = 1;
|
||||
else if (stmp == "HIGH")
|
||||
audio_thread_priority = 2;
|
||||
else
|
||||
audio_thread_priority = -1;
|
||||
}
|
||||
|
||||
void audio_load_loaders(void) {
|
||||
|
@ -20,6 +20,7 @@ extern EXPCL_PANDA int audio_buffer_size;
|
||||
extern EXPCL_PANDA string* audio_device;
|
||||
extern EXPCL_PANDA int audio_auto_update_delay;
|
||||
extern EXPCL_PANDA bool audio_is_active;
|
||||
extern EXPCL_PANDA int audio_thread_priority;
|
||||
|
||||
extern EXPCL_PANDA void audio_load_loaders(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user