From e33da413b49918100778dcf878877cc7f615ea03 Mon Sep 17 00:00:00 2001 From: sletz Date: Tue, 6 May 2008 10:48:06 +0000 Subject: [PATCH] Correct JackPosixThread::StartImp git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2239 0c269be4-1314-0410-8aa9-9f06e86f4224 --- common/JackPosixThread.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/common/JackPosixThread.cpp b/common/JackPosixThread.cpp index 0ab6b877..ccc47257 100644 --- a/common/JackPosixThread.cpp +++ b/common/JackPosixThread.cpp @@ -74,11 +74,6 @@ int JackPosixThread::StartImp(pthread_t* thread, int priority, int realtime, voi pthread_attr_init(&attributes); int res; - if ((res = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED))) { - jack_error("Cannot request explicit scheduling for RT thread res = %d err = %s", res, strerror(errno)); - return -1; - } - if ((res = pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_JOINABLE))) { jack_error("Cannot request joinable thread creation for RT thread res = %d err = %s", res, strerror(errno)); return -1; @@ -92,6 +87,11 @@ int JackPosixThread::StartImp(pthread_t* thread, int priority, int realtime, voi if (realtime) { jack_log("Create RT thread"); + + if ((res = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED))) { + jack_error("Cannot request explicit scheduling for RT thread res = %d err = %s", res, strerror(errno)); + return -1; + } //if ((res = pthread_attr_setschedpolicy(&attributes, SCHED_FIFO))) { if ((res = pthread_attr_setschedpolicy(&attributes, SCHED_RR))) { @@ -131,7 +131,7 @@ int JackPosixThread::StartSync() int JackPosixThread::Kill() { - if (fThread != NULL) { // If thread has been started + if (fThread != (pthread_t)NULL) { // If thread has been started jack_log("JackPosixThread::Kill"); void* status; pthread_cancel(fThread); @@ -146,7 +146,7 @@ int JackPosixThread::Kill() int JackPosixThread::Stop() { - if (fThread != NULL) { // If thread has been started + if (fThread != (pthread_t)NULL) { // If thread has been started jack_log("JackPosixThread::Stop"); void* status; fStatus = kIdle; // Request for the thread to stop @@ -160,7 +160,7 @@ int JackPosixThread::Stop() int JackPosixThread::AcquireRealTime() { - return (fThread != NULL) ? AcquireRealTimeImp(fThread, fPriority) : -1; + return (fThread != (pthread_t)NULL) ? AcquireRealTimeImp(fThread, fPriority) : -1; } int JackPosixThread::AcquireRealTime(int priority) @@ -189,7 +189,7 @@ int JackPosixThread::AcquireRealTimeImp(pthread_t thread, int priority) int JackPosixThread::DropRealTime() { - return (fThread != NULL) ? DropRealTimeImp(fThread) : -1; + return (fThread != (pthread_t)NULL) ? DropRealTimeImp(fThread) : -1; } int JackPosixThread::DropRealTimeImp(pthread_t thread)