Currently only tested on my Linux machine, using PortAudio -> Alsa -> PulseAudio -> JACK.
Once in a while I'm seeing that the semaphore is at 0 even after the sem_post call, implying that sem_wait was called twice. I'm not sure if the callback is getting called reentrantly by the audio system or what.
The cpu_usage branch has a printf whenever the semaphore is not what it's supposed to be. I'd be interested to see if this happens on other platforms as well. I'll test on OSX tonight.
nevermind, I think this was just a race condition in my testing code, where by the time I checked the value of the semaphore the callback had already run again and re-waited.
Currently only tested on my Linux machine, using PortAudio -> Alsa -> PulseAudio -> JACK.
Once in a while I'm seeing that the semaphore is at 0 even after the
sem_post
call, implying thatsem_wait
was called twice. I'm not sure if the callback is getting called reentrantly by the audio system or what.The
cpu_usage
branch has a printf whenever the semaphore is not what it's supposed to be. I'd be interested to see if this happens on other platforms as well. I'll test on OSX tonight.