Am 28.12.2007 um 20:25 schrieb Miller Puckette:
I should have put the lock in and forgot... thanks for the reminder.
I'm not at all sure how to handle "idle" in the callback case. One could just call the function forever, but that seems like burning the CPU for nothing.
You might have noticed that the idle callback function in pd-devel
returns 0 (when it never wants to be called again), 1 (when it wants
to be called again as soon as possible) or 2 (when it wants to be
called again at the next scheduler iteration). This works pretty well
and helps to preserve cpu.
Alternatively, "idle" processing might want to take place in a different thread to be set up by whatever external code wants to do the idle processing, trusting to the OS to preempt to the callback thread when it becomes runnable.
It's a cleaner approach given the fact that the functionality allowed
within the audio driver callback is limited, but it involves locking
which isn't nice.
gr~~~