Browse Source

macOS related fixes

Signed-off-by: falkTX <falktx@falktx.com>
pull/976/head
falkTX 1 year ago
parent
commit
c46c1b16e0
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 4 additions and 16 deletions
  1. +0
    -7
      common/JackClient.cpp
  2. +3
    -8
      macosx/JackMachThread.mm
  3. +1
    -1
      posix/JackSocket.cpp

+ 0
- 7
common/JackClient.cpp View File

@@ -639,13 +639,6 @@ inline bool JackClient::WaitSync()
{
// Suspend itself: wait on the input synchro
if (GetGraphManager()->SuspendRefNum(GetClientControl(), fSynchroTable, LONG_MAX) < 0) {
#ifdef __APPLE__
// FIXME macOS reports wait failures when closing down, due to aborted semaphore, ignore it
if (!GetClientControl()->fActive) {
fThread.Terminate();
return true;
}
#endif
jack_error("SuspendRefNum error");
return false;
} else {


+ 3
- 8
macosx/JackMachThread.mm View File

@@ -46,7 +46,7 @@ int JackMachThread::SetThreadToPriority(jack_native_thread_t thread, UInt32 inPr
#endif
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 res = %ld", res);
jack_log("JackMachThread::thread_policy_set RT res = %ld", res);
return (res == KERN_SUCCESS) ? 0 : -1;
} else {
// OTHER THREADS
@@ -69,7 +69,7 @@ int JackMachThread::SetThreadToPriority(jack_native_thread_t thread, UInt32 inPr

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 res = %ld", res);
jack_log("JackMachThread::thread_policy_set non-RT res = %ld", res);
return (res == KERN_SUCCESS) ? 0 : -1;
}
}
@@ -160,21 +160,16 @@ int JackMachThread::GetParams(jack_native_thread_t thread, UInt64* period, UInt6

int JackMachThread::Kill()
{
#if 0
// NOTE: starting macOS 12, this code no longer works
if (fThread != (jack_native_thread_t)NULL) { // If thread has been started
jack_log("JackMachThread::Kill");
mach_port_t machThread = pthread_mach_thread_np(fThread);
int res = (thread_terminate(machThread) == KERN_SUCCESS) ? 0 : -1;
int res = (thread_abort(machThread) == KERN_SUCCESS) ? 0 : -1;
fStatus = kIdle;
fThread = (jack_native_thread_t)NULL;
return res;
} else {
return -1;
}
#else
return JackPosixThread::Kill();
#endif
}

int JackMachThread::AcquireRealTime()


+ 1
- 1
posix/JackSocket.cpp View File

@@ -202,7 +202,7 @@ int JackClientSocket::Read(void* data, int len)
jack_error("Cannot read socket fd = %d res = %d err = %s", fSocket, res, strerror(errno));
//return 0;
return -1;
} else if (errno == 0) {
} else if (errno == 0 || errno == ENOTCONN) {
// aborted reading due to shutdown
return JACK_REQUEST_ERR_ABORTED;
} else {


Loading…
Cancel
Save