[PD-dev] figuring out how to get everything merged

Christof Ressi info at christofressi.com
Sat Feb 4 22:32:20 CET 2023


> Meanwhile there's Christof's semaphor feature which promises to lower latency
> (I tried doing this earlier in s_audio_pa.c but found it actually increased
> latency; not sure what's going on here).

I guess you are talking about the THREADSIGNAL part (which has never 
been enabled, except for a very brief moment).

There are two major differences to my new implementation:

a) I use a semaphore instead of a condition variable to avoid 
unnecessary mutex locking.

b) The old THREADSIGNAL implementation would sleep on the condition 
variable as soon as the FIFO is empty/full. This would waste precious 
time that could be spent otherwise, in particular with larger hardware 
buffer sizes.
In my implementation, on the other hand, I check the ringbuffer in a 
loop and only sleep on the semaphore when Pd is really idle, i.e. 
sched_idletask() has returned 0. See also 
https://github.com/pure-data/pure-data/pull/1756/commits/de8c62e0ce726634cba7570016a1b256eb724540.

Christof






More information about the Pd-dev mailing list