[PD-dev] how to not cause audio drops with threads

Tom Schouten doelie at zzz.kotnet.org
Sat Sep 11 23:54:45 CEST 2004


On Fri, Sep 10, 2004 at 10:50:46AM +0200, Thomas Grill wrote:

Hi Grill,

> the ring buffer idea is really great and if you don't mind i'll take this
> over to flext which uses dynamic allocation at the moment.

of course not.

> The flext message queue has a worker thread which is sleeping until being
> triggered by a thread signal whenever a new message needs to be delivered.
> It then takes the pd global thread lock (sys_lock) and sends the messages to
> pd. I consider this to be quite clean since message delivery will take
> little time.
> I have chosen this way to work with any pd version, but there a sure more
> efficient ways which probably only Miller can tell....
> 

so you do use locks in the communication protocol between 2 threads?

if so, that's exactly what i'm trying to avoid with this.. in practice it
works most of the time for small things, but it's no guarantee to avoid
priority inversion. there's interesting stuff about this on the LAD list 
you know.

but, i was thinking that making some pattern doc + code snippets you can
include in your own external code might be enough to somehow standardize this,
instead of adding it to pd.

pls keep me informed of changes to flext.

cheers
tom




More information about the Pd-dev mailing list