Multi-threading and Global Variables

wilcofan

2014-08-26 14:29:14

Can someone confirm something for me?

Last night I was trying to delay the change in a global variable. Four translators, one original trigger:

1. receive button press (arm track OFF)

2. send the 1st message (mute MACKIE track OFF)

3. react to the 1st message, if g1==1, skip outgoing, otherwise send 2nd message (mute DAW track OFF)

4. react to the 1st message, set timer

-- delay --

5. react to the timer, send 3rd message (arm DAW track OFF), make g1=0

I created a timer to delay the changing of the global variable, g1, but no matter how long I used, the 3rd step fails every time. It's supposed to still be g1==1, until I say so in the 5th step. This got me thinking the processing of the variable happens pre-emptive. And that the outgoing action may be delayed indefinitely but the rules of the 5th message are already processed.

Confirm?

DvlsAdvct

2014-08-26 17:47:03

g1 should not be made 0 until the delayed timer translator goes off. When, in the process, do you make g1=1?

wilcofan

2014-08-26 18:08:20

no, g1=1, is set before any of this happens.

(when the arm button was turned on last)

DvlsAdvct

2014-08-26 18:12:44

What are the exact rules you're using? if it's

if g1==1 then exit rules, execute outgoing action

then try

if g1!=0 then exit rules, execute outgoing action

wilcofan

2014-08-26 18:15:57

Yes, I updated my first post.
I am trying to NOT send the message if g1==1.

if g1==1 then exit rules, skip outgoing action

Good tip on the opposite though.

DvlsAdvct

2014-08-26 18:31:27

Do me a favor and deactivate the timer translator that sets g1 to 0. Go through the process and in the log window dump the global variables. Does g1=1 or g1=0?

wilcofan

2014-08-26 19:10:27

AH!! thank you.

I've been muttering to myself how much better this would be if I could see the state of the variables.

Is that what "dump" means?

DvlsAdvct

2014-08-26 19:11:15

Yup. It took my a long time to figure that out.

wilcofan

2014-08-26 19:17:06

Everytime I read that button in the log I thought:

"If I want to initialize the values why wouldn't I just re-open the file!?" (dump, as in "get rid of" in English?)

Ah. That's much better.

DvlsAdvct

2014-08-26 20:47:58

Is this working now, or are we still trying to figure it out? Got derailed

wilcofan

2014-08-26 21:05:17

No, it's not working. But I'll have much better debugging and I'll get back to you tomorrow. (at work now)