PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.39k stars 291 forks source link

dubious pthread cond var usage in pa_jack.c #879

Open RossBencina opened 6 months ago

RossBencina commented 6 months ago

As noted in a comment on #820 pa_jack.c is not using posix condition variables correctly:

  1. WaitCondition() and its callers are not running a loop to deal with spurious wakeups (which are a thing for pthread cond vars)
  2. WaitCondition() and its callers are not using cond vars correctly: there should be a variable (or variables) associated with the cond var that are used to signal/check the desired condition. by itself a cond var is just a wakeup mechanism, unlike a semaphore or a Windows Event object a cond var doesn't encode any information about whether the condition has been met, infact it can wake up spuriously and signal no error.