Hi,
since the outlet_*() functions in Pd are not threadsafe, what's the best
way to output data in a threaded external?
I've used a t_clock that gets called (clock_delay(x->x_outclock, 0))
from the child thread (in oggcast~ for example). But my externals using
this method tend to crash after a while (with a segfault in pd.dll under
Win2k). Sometime after a few minutes, sometimes it takes several hours.
I've now deleted this functions and it seems to work. But I've lost
output!
Is there any other way to do this? I could use a t_clock that calls
itselfe over and over again, lets say every 10 milliseconds and check
the variables for changes... Any other ideas? Or any other ideas what
the reason for the crashes might be?
Olaf
PS:
a short list of precautions I've (not successfully) tried to get the
t_clocks perform all right:
- locking the mutex before calling outlet_*
- unsetting the t_clock before setting it (in case it's already set and
not yet executed by the scheduler) BTW, is there a way to test if a
t_clock is already set?
- making local copy of variables to output