[PD-dev] why must one never send a message from a perform routine ?

Joseph Larralde joseph.larralde at gmail.com
Mon Aug 21 18:02:52 CEST 2023


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
www.josephlarralde.fr






More information about the Pd-dev mailing list