[PD] Externals with threads ...

Tim Blechmann TimBlechmann at gmx.net
Tue Jan 25 09:11:43 CET 2005


> I'm wondering what peoples opinions are on the subject of externals
> with their own threads. Are there reasons this is is not advised (e.g.
> reentrancy of subsequent calls)? To be specific I'm talking about
> threads that initiate output. I've looked at the sourcecode for
> netreceive and noticed the use of sys_addpollfn, but as this method is
> not included in m_pd.h, i wonder if it's even intended to be used in
> externals. One of the reasons i ask is that the example/test code
> attached bellow seems to work on one of my machines (Pentium 4/Fedora
> 2/PD 0.37.1), but when I run it on another (a PowerbookG4/Gentoo/PD
> 37.4) I get a stack overflow at the outlet_float. 
well ... the only threadsafe way to synchronize helper threads with the
main pd thread is to place callbacks in the scheduler.
afaik the only externals using them are flext and join.
still, the |read( message to the threaded soundfiler should give you an
idea, how threadsafe external programming can be done. (recent
devel_0_38)

problem: the possibility to place callback in the scheduler is NOT
implemented in any stable release. still, i hope it will make it's way
to 0.39...

cheers ... tim

-- 
mailto:TimBlechmann at gmx.de    ICQ: 96771783
http://www.mokabar.tk

latest mp3:
http://jokebux.klingt.org/gro.tgnilk/mp3s/2317/index.html

After one look at this planet any visitor from outer space 
would say "I want to see the manager."
				      William S. Burroughs




More information about the Pd-list mailing list