[PD-dev] Synchronizing Branches

Frank Barknecht fbar at footils.org
Tue Apr 29 10:12:45 CEST 2003

Michael McGonagle hat gesagt: // Michael McGonagle wrote:

> I have written some code that sends messages to various branches of 
> other processing code. Two of these branches rely on each other, and I 
> also need to make sure that one branch has completely executed prior to 
> the other passing beyond a certain point.
> Basically what I have done is to stick a 'delay 0' object in the 
> "dependant" branch. Am I correct in that using this forces this branch 
> to "postpone" itself, allowing the other branch to complete its code? 
> This has been working for me, as I had hoped, but I was wondering if 
> there is a better way to handle this.

First: Why didn't you just change the "one-two-three" triggers so that
the rightmost one sends "two" and the middle one sends "one"? I guess,
for analytical reasons, didn't you? 

Then [delay 0] in theory should do just that: delay for no time, as if
it weren't there. It obviously doesn't do that. In my eyes this is
wrong and a bug. So I wouldn't rely on it for ordering of messages. It
sure is better to order with trigger-objects.

> I can see one problem with this if there is a dependancy of several 
> branches. Short of having the code branches merge, is there some other 
> way to achieve this? Are there such things as state flags or "semifores" 
> in pd? (ie don't continue until "my-state" is true).

As I said: Why not order the branch at the root with the correct
trigger ordering?

 Frank Barknecht                               _ ______footils.org__

More information about the Pd-dev mailing list