Fix IO Thread priority
This adds `pbd_pthread_priority` indirection to correctly get the absolute thread priority. and for consistency a 4 letter enum is used.
This commit is contained in:
parent
5efa5b4529
commit
0aff098541
@ -76,7 +76,7 @@ IOTaskList::IOTaskList (uint32_t n_threads)
|
||||
|
||||
_workers.resize (_n_threads);
|
||||
for (uint32_t i = 0; i < _n_threads; ++i) {
|
||||
if (!use_rt || pbd_realtime_pthread_create (policy, THREAD_IO, 0, &_workers[i], &_worker_thread, this)) {
|
||||
if (!use_rt || pbd_realtime_pthread_create (policy, PBD_RT_PRI_IOFX, 0, &_workers[i], &_worker_thread, this)) {
|
||||
if (use_rt && i == 0) {
|
||||
PBD::warning << _("IOTaskList: cannot acquire realtime permissions.") << endmsg;
|
||||
}
|
||||
|
@ -58,6 +58,7 @@
|
||||
# define PBD_RT_PRI_MIDI pbd_pthread_priority (THREAD_MIDI)
|
||||
# define PBD_RT_PRI_PROC pbd_pthread_priority (THREAD_PROC)
|
||||
# define PBD_RT_PRI_CTRL pbd_pthread_priority (THREAD_CTRL)
|
||||
# define PBD_RT_PRI_IOFX pbd_pthread_priority (THREAD_IOFX)
|
||||
|
||||
LIBPBD_API int pthread_create_and_store (std::string name, pthread_t *thread, void * (*start_routine)(void *), void * arg, uint32_t stacklimit = 0x80000 /*512kB*/);
|
||||
LIBPBD_API void pthread_cancel_one (pthread_t thread);
|
||||
@ -73,7 +74,7 @@ enum PBDThreadClass {
|
||||
THREAD_MIDI, // MIDI I/O threads
|
||||
THREAD_PROC, // realtime worker
|
||||
THREAD_CTRL, // Automation watch, BaseUI
|
||||
THREAD_IO // non-realtime I/O
|
||||
THREAD_IOFX // non-realtime I/O and regionFX
|
||||
};
|
||||
|
||||
LIBPBD_API int pbd_pthread_priority (PBDThreadClass);
|
||||
|
@ -348,7 +348,7 @@ pbd_pthread_priority (PBDThreadClass which)
|
||||
case THREAD_CTRL:
|
||||
default:
|
||||
return -14; // THREAD_PRIORITY_HIGHEST (2)
|
||||
case THREAD_IO:
|
||||
case THREAD_IOFX:
|
||||
/* https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-libraries/winpthreads/src/sched.c */
|
||||
return -15; // THREAD_PRIORITY_ABOVE_NORMAL (1)
|
||||
}
|
||||
@ -372,7 +372,7 @@ pbd_pthread_priority (PBDThreadClass which)
|
||||
return base - 2;
|
||||
case THREAD_CTRL:
|
||||
return base - 3;
|
||||
case THREAD_IO:
|
||||
case THREAD_IOFX:
|
||||
return base - 10;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user