[PD-dev] clocks & threads

Olaf Matthes olaf.matthes at gmx.de
Thu Dec 5 12:01:41 CET 2002


Thomas Grill schrieb:

> you're right that there has to be a solution in PD itself.
> It did work for me only because of the fact that hardly anyone seemed
> to care about threads....

My solution after some (by that time) unexplainable 'voodoo crahses' with
oggcast~ was to use clocks as a sort of callback function. I pass data
between the main thrad of my external and it's child thread using a mutex.
The output is realised by setting a clock (from the main thread!) that calls
itselfe over and over again. In this function I then lock the mutex and
check wether some data has changed and needs to be output.... (setting a
clock with clock_delay(myclock, 0) from within the child thread crashed Pd
(it sometimes worked for some hours but in the end it sooner or later
crashed)).
This is of course not very efficient and a possibility to set a clock _only_
when it is needed would make things much easier.

Olaf





More information about the Pd-dev mailing list