Browse Source

JackPosixProcessSync: Fix mutex owner on TimedWait() timeout.

Per POSIX definition, pthread_cond_timedwait() re-acquires the mutex
when a timeout occurs and ETIMEDOUT is returned. In that case also
mark the waiting thread as owner again, for consistency.
Otherwise subsequent attempts to unlock the mutex will fail, leaving
the mutex locked forever.
pull/952/head
Florian Walpen 1 year ago
parent
commit
e7cb3fd1af
No known key found for this signature in database GPG Key ID: E11C40B3BC8863BC
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      posix/JackPosixProcessSync.cpp

+ 1
- 1
posix/JackPosixProcessSync.cpp View File

@@ -122,7 +122,7 @@ bool JackPosixProcessSync::TimedWait(long usec)
time.tv_nsec = (next_date_usec % 1000000) * 1000;

res = pthread_cond_timedwait(&fCond, &fMutex, &time);
if (res != 0) {
if (res != 0 && res != ETIMEDOUT) {
jack_error("JackPosixProcessSync::TimedWait error usec = %ld err = %s", usec, strerror(res));
} else {
fOwner = pthread_self();


Loading…
Cancel
Save