Jump to content

Programming question regarding state variable changes


JTsao

Recommended Posts

Posted

I have a state variable called sLastAction - it is set to an integer value which represents, as the name suggests, the most recent "action" that happened in my house - an "action" can be a motion sensor turning on, a wall switch being turned on or off, a Harmony remote control activity starting, door opening, security zone being triggered, etc... - several programs rely on this variable being a specific value to run - they all contain an if statement similar the following "if sLastAction = 128 then..." - my question is:

What happens if the variable changes twice rapidly before the first program testing the first value gets to run?

Will that program be put into a queue so that it is guaranteed to run?  And the test condition will still be true?

Sorry, if this has been asked before

 

 

 

Posted

@JTsao, events (including variable status change events) all go into a queue (FIFO). So, how rapidly things change only change the order of the event in the queue. In short, all are processed one at a time in  FIFO manner.

With kind regards,
Michel

  • Like 1
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.4k
×
×
  • Create New...