Hi Olaf, it should be possible, provided your code (running in the second thread) does not use any calls to the C library or other shared libraries which other threads might use as well. In this sense, also malloc and free or similar calls are critical when the libraries are not prepared for multithreaded operation. I haven't tried if it is sufficient to compile and link pd with the multithreaded runtime libraries... did you try that? If i remember correctly, to use library calls as well there exists a special "init call" for the runtime library corresponding to the _beginthread call.
greetings, Thomas
-----Ursprungliche Nachricht----- Von: Olaf Matthes [mailto:olaf.matthes@gmx.de] Gesendet: Montag, 18. Februar 2002 22:18 An: pd-list Betreff: [PD] multithreaded externals?
Hi list,
I'm searching for a way to make an external multithreaded.
I'm currently working on oggamp~, an ogg/vorbis streaming client. The problem is that I have to receive data from the server in 4k packets and the time needed to do this is too long to place the function call inside the dsp perform routine. Is there any way provided by pd to have the receive function executed in a different thread? Or the other way round, could someone point me to code where I can see how to realise multithreading in an pd external? I tried '_beginthread' under NT but get a lot of memory related errors...
Btw., a new external can be found at http://www.akustische-kunst.de/puredata/ : oggread~ reads and decodes ogg vorbis encoded files from disk.
Olaf