Hi Joseph -
If you send a message from within the DSP chain that causes the chain
itself to be rebuilt it will crash Pd. That's not a thread problem, but
a (sort of) reentrancy problem. If you're the only user of your object
you can simply avoid doing that, but if you're publishing your object it
might bite someone else.
The built-in objects "delay", "metro" and "pipe" use clocks in various ways.
cheers
Miller
On 8/21/23 18:02, Joseph Larralde wrote:
Howdy,
I just read in an answer from Christof to Alexandre : "never ever send
a Pd message directly from a perform routine ! Always use a clock !"
But I never took the time to deeply understand Pd's inner working and
am not sure why it is bad practice.
Not sure what could be the consequences of doing this, but it might
explain a random bug I've been experiencing with one of my externals.
I wrote a couple of plugins with juce so I'm aware of the most basic
good lock-free programming practices in C++ (which seems to boil down
to : use atomic variables in C++, or a lock-free queue if needed).
Could Christof's advice be related to threading issues ?
I thought I'd read somewhere that everything was running on the same
thread in Pd (at least the "backend", maybe not the GUI), but please
correct me if I'm wrong.
Also, I'm having a hard time finding any doc about clocks, is there a
known object that uses them that I could take as an example ?
Sorry if this has been brought up before (which is probably the case),
and thanks in advance for your enlightenments.
Cheers,
Joseph Larralde
--
freelance developer
https://urldefense.com/v3/__http://www.josephlarralde.fr__;!!Mih3wA!BKes5WdOYsVFB7W7WB-wjSV68fDm8QdVtU3X8gHlDxWYuDjEucRSLIueYpmQMzz8tn7hNw_Clb4ROP_Tvl82mQ$
_______________________________________________
Pd-dev mailing list
[email protected]
https://urldefense.com/v3/__https://lists.puredata.info/listinfo/pd-dev__;!!Mih3wA!BKes5WdOYsVFB7W7WB-wjSV68fDm8QdVtU3X8gHlDxWYuDjEucRSLIueYpmQMzz8tn7hNw_Clb4ROP8I6z_7xg$
_______________________________________________
Pd-dev mailing list
[email protected]
https://lists.puredata.info/listinfo/pd-dev