git-svn-id: svn+ssh://jackaudio.org/trunk/jack@3051 0c269be4-1314-0410-8aa9-9f06e86f4224tags/0.115.6
@@ -16,8 +16,8 @@ dnl micro version = incremented when implementation-only | |||||
dnl changes are made | dnl changes are made | ||||
dnl --- | dnl --- | ||||
JACK_MAJOR_VERSION=0 | JACK_MAJOR_VERSION=0 | ||||
JACK_MINOR_VERSION=114 | |||||
JACK_MICRO_VERSION=3 | |||||
JACK_MINOR_VERSION=115 | |||||
JACK_MICRO_VERSION=0 | |||||
dnl --- | dnl --- | ||||
dnl HOWTO: updating the jack protocol version | dnl HOWTO: updating the jack protocol version | ||||
@@ -180,6 +180,7 @@ typedef struct { | |||||
int8_t do_mlock; | int8_t do_mlock; | ||||
int8_t do_munlock; | int8_t do_munlock; | ||||
int32_t client_priority; | int32_t client_priority; | ||||
int32_t max_client_priority; | |||||
int32_t has_capabilities; | int32_t has_capabilities; | ||||
float cpu_load; | float cpu_load; | ||||
float xrun_delayed_usecs; | float xrun_delayed_usecs; | ||||
@@ -37,6 +37,22 @@ extern "C" { | |||||
* handling of realtime scheduling and associated privileges. | * handling of realtime scheduling and associated privileges. | ||||
*/ | */ | ||||
/** | |||||
* @returns if JACK is running with realtime scheduling, this returns | |||||
* the priority that any JACK-created client threads will run at. | |||||
* Otherwise returns -1. | |||||
*/ | |||||
int jack_client_real_time_priority (jack_client_t*); | |||||
/** | |||||
* @returns if JACK is running with realtime scheduling, this returns | |||||
* the maximum priority that a JACK client thread should use if the thread | |||||
* is subject to realtime scheduling. Otherwise returns -1. | |||||
*/ | |||||
int jack_client_max_real_time_priority (jack_client_t*); | |||||
/** | /** | ||||
* Attempt to enable realtime scheduling for a thread. On some | * Attempt to enable realtime scheduling for a thread. On some | ||||
* systems that may require special privileges. | * systems that may require special privileges. | ||||
@@ -1843,9 +1843,20 @@ jack_engine_new (int realtime, int rtpriority, int do_mlock, int do_unlock, | |||||
engine->control->port_max = engine->port_max; | engine->control->port_max = engine->port_max; | ||||
engine->control->real_time = realtime; | engine->control->real_time = realtime; | ||||
/* leave some headroom for other client threads to run | |||||
with priority higher than the regular client threads | |||||
but less than the server. see thread.h for | |||||
jack_client_real_time_priority() and jack_client_max_real_time_priority() | |||||
which are affected by this. | |||||
*/ | |||||
engine->control->client_priority = (realtime | engine->control->client_priority = (realtime | ||||
? engine->rtpriority - 1 | |||||
? engine->rtpriority - 5 | |||||
: 0); | : 0); | ||||
engine->control->max_client_priority = (realtime | |||||
? engine->rtpriority - 1 | |||||
: 0); | |||||
engine->control->do_mlock = do_mlock; | engine->control->do_mlock = do_mlock; | ||||
engine->control->do_munlock = do_unlock; | engine->control->do_munlock = do_unlock; | ||||
engine->control->cpu_load = 0; | engine->control->cpu_load = 0; | ||||
@@ -198,6 +198,26 @@ jack_client_create_thread (jack_client_t* client, | |||||
return 0; | return 0; | ||||
} | } | ||||
int | |||||
jack_client_real_time_priority (jack_client_t* client) | |||||
{ | |||||
if (!client->engine->real_time) { | |||||
return -1; | |||||
} | |||||
return client->engine->client_priority; | |||||
} | |||||
int | |||||
jack_client_max_real_time_priority (jack_client_t* client) | |||||
{ | |||||
if (!client->engine->real_time) { | |||||
return -1; | |||||
} | |||||
return client->engine->max_client_priority; | |||||
} | |||||
#if JACK_USE_MACH_THREADS | #if JACK_USE_MACH_THREADS | ||||
int | int | ||||
@@ -256,3 +276,4 @@ jack_acquire_real_time_scheduling (pthread_t thread, int priority) | |||||
} | } | ||||
#endif /* JACK_USE_MACH_THREADS */ | #endif /* JACK_USE_MACH_THREADS */ | ||||