From e737a9b00046c976409752da0f3b317c0599da27 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 24 Feb 2020 04:38:49 +0100 Subject: Fix setting CoreAudio RT-priority --- libs/pbd/pthread_utils.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libs/pbd/pthread_utils.cc b/libs/pbd/pthread_utils.cc index e8a17792c2..2e2d2c820e 100644 --- a/libs/pbd/pthread_utils.cc +++ b/libs/pbd/pthread_utils.cc @@ -36,6 +36,12 @@ DECLARE_DEFAULT_COMPARISONS(pthread_t) // Needed for 'DECLARE_DEFAULT_COMPARISO // to be the case with ptw32 'pthread_t' which is a simple struct. #endif +#ifdef __APPLE__ +#include +#include +#include +#endif + using namespace std; typedef std::list ThreadMap; @@ -271,15 +277,15 @@ pbd_set_thread_priority (pthread_t thread, const int policy, int priority) bool pbd_mach_set_realtime_policy (pthread_t thread_id, double period_ns) { -#ifdef _APPLE_ +#ifdef __APPLE__ thread_time_constraint_policy_data_t policy; #ifndef NDEBUG mach_msg_type_number_t msgt = 4; boolean_t dflt = false; - kern_return_t rv = thread_policy_get (pthread_mach_thread_np (_main_thread), + kern_return_t rv = thread_policy_get (pthread_mach_thread_np (thread_id), THREAD_TIME_CONSTRAINT_POLICY, (thread_policy_t) &policy, &msgt, &dflt); - printf ("Mach Thread(%p) %d %d %d %d DFLT %d OK: %d\n", _main_thread, policy.period, policy.computation, policy.constraint, policy.preemptible, dflt, rv == KERN_SUCCESS); + printf ("Mach Thread(%p) %d %d %d %d DFLT %d OK: %d\n", thread_id, policy.period, policy.computation, policy.constraint, policy.preemptible, dflt, rv == KERN_SUCCESS); #endif mach_timebase_info_data_t timebase_info; -- cgit v1.2.3