Commit b44e22de authored by sletz's avatar sletz
Browse files

Use of set_threaded_log_function only when needed in RT threads.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2450 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 3861dc6e
......@@ -20,6 +20,10 @@ Fernando Lopez-Lezcano
Jackdmp changes log
---------------------------
2008-06-04 Stephane Letz <letz@grame.fr>
* Use of set_threaded_log_function only when needed in RT threads.
2008-06-02 Stephane Letz <letz@grame.fr>
* Tim Blechmann patch to remove unnecessary virtual methods : choice of the appropriate platform version is now done at compilation time.
......
......@@ -340,6 +340,9 @@ bool JackClient::Execute()
{
if (!jack_tls_set(gRealTime, this))
jack_error("failed to set thread realtime key");
if (GetEngineControl()->fRealTime)
set_threaded_log_function();
if (fThreadFun) {
// Execute a dummy cycle to be sure thread has the correct properties (ensure thread creation is finished)
......
......@@ -63,9 +63,7 @@ void jack_log_function(int level, const char *message)
log_callback(message);
}
static
void
jack_format_and_log(int level, const char *prefix, const char *fmt, va_list ap)
static void jack_format_and_log(int level, const char *prefix, const char *fmt, va_list ap)
{
char buffer[300];
size_t len;
......
......@@ -40,8 +40,6 @@ void* JackPosixThread::ThreadHandler(void* arg)
jack_error("pthread_setcanceltype err = %s", strerror(err));
}
set_threaded_log_function();
// Signal creation thread when started with StartSync
jack_log("ThreadHandler: start");
obj->fStatus = kIniting;
......
......@@ -108,8 +108,11 @@ bool JackThreadedDriver::Init()
jack_log("JackThreadedDriver::Init IsRealTime");
// Will do "something" on OSX only...
fThread.SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint);
if (fThread.AcquireRealTime(GetEngineControl()->fPriority) < 0)
if (fThread.AcquireRealTime(GetEngineControl()->fPriority) < 0) {
jack_error("AcquireRealTime error");
} else {
set_threaded_log_function();
}
}
return true;
} else {
......
......@@ -837,6 +837,9 @@ void *midi_thread(void *arg)
pfds[0].events = POLLIN|POLLERR|POLLNVAL;
npfds = 1;
if (jack_is_realtime(midi->client))
set_threaded_log_function();
//debug_log("midi_thread(%s): enter", str->name);
while (midi->keep_walking) {
......
......@@ -39,7 +39,7 @@ int JackMachThread::SetThreadToPriority(pthread_t thread, UInt32 inPriority, Boo
theTCPolicy.constraint = AudioConvertNanosToHostTime(constraint);
theTCPolicy.preemptible = true;
kern_return_t res = thread_policy_set(pthread_mach_thread_np(thread), THREAD_TIME_CONSTRAINT_POLICY, (thread_policy_t) & theTCPolicy, THREAD_TIME_CONSTRAINT_POLICY_COUNT);
jack_log("JackMachThread::thread_policy_set %ld", res);
jack_log("JackMachThread::thread_policy_set res = %ld", res);
return (res == KERN_SUCCESS) ? 0 : -1;
} else {
// OTHER THREADS
......@@ -62,7 +62,7 @@ int JackMachThread::SetThreadToPriority(pthread_t thread, UInt32 inPriority, Boo
thePrecedencePolicy.importance = relativePriority;
kern_return_t res = thread_policy_set(pthread_mach_thread_np(thread), THREAD_PRECEDENCE_POLICY, (thread_policy_t) & thePrecedencePolicy, THREAD_PRECEDENCE_POLICY_COUNT);
jack_log("JackMachThread::thread_policy_set %ld", res);
jack_log("JackMachThread::thread_policy_set res = %ld", res);
return (res == KERN_SUCCESS) ? 0 : -1;
}
}
......
......@@ -34,9 +34,7 @@ DWORD WINAPI JackWinThread::ThreadHandler(void* arg)
{
JackWinThread* obj = (JackWinThread*)arg;
JackRunnableInterface* runnable = obj->fRunnable;
set_threaded_log_function();
// Signal creation thread when started with StartSync
jack_log("ThreadHandler: start");
obj->fStatus = kIniting;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment