09-18-2017 03:59 PM
If I wire 100 to the hourglass symbol for the Event Structure Timeout case, does it mean every 100 ms if not other events occur, what ever is in the Timeout case excecutes?
Solved! Go to Solution.
09-18-2017 04:26 PM - edited 09-18-2017 04:28 PM
Yes. If you wire a -1 to the timeout value, the timeout case will never execute.
09-18-2017 04:31 PM
Yes, this is how it will behave. This means that if you need something to occur every 100 ms, do not include processing for other events in your event structure.
Here is a very simple test to illustrate how it behaves.
\
09-18-2017 05:47 PM
Also note that if you constantly trigger other events, the code in the timeout event might never execute, of course. 😄
01-19-2022 11:58 AM
@altenbach wrote:
Also note that if you constantly trigger other events, the code in the timeout event might never execute, of course. 😄
I realize this is an old thread, but this is true even if timeout is 0? (That's because that events are a queue, and the timeout event is only triggered when the event queue is empty & the wired time has passed? In that way, if you are constantly triggering other events the queue may never be empty.)
01-20-2022 02:08 AM
Mmmm... confusion about your post. I don't understand how the queue status is related to the timeout in an event structure.
Can you show an example of what you are doing (or want to do?).
01-20-2022 02:14 AM
@WavePacket wrote:
@altenbach wrote:
Also note that if you constantly trigger other events, the code in the timeout event might never execute, of course. 😄
I realize this is an old thread, but this is true even if timeout is 0? (That's because that events are a queue, and the timeout event is only triggered when the event queue is empty & the wired time has passed? In that way, if you are constantly triggering other events the queue may never be empty.)
If events are happening faster then they can be handled, then the timeout case can't execute. However, in such a case your program is going to fail anyway, as you queue up unhandled events until running out of memory.
01-20-2022 07:23 AM
@drjdpowell wrote:
@WavePacket wrote:
@altenbach wrote:
Also note that if you constantly trigger other events, the code in the timeout event might never execute, of course. 😄
I realize this is an old thread, but this is true even if timeout is 0? (That's because that events are a queue, and the timeout event is only triggered when the event queue is empty & the wired time has passed? In that way, if you are constantly triggering other events the queue may never be empty.)
If events are happening faster then they can be handled, then the timeout case can't execute. However, in such a case your program is going to fail anyway, as you queue up unhandled events until running out of memory.
Yeah, I guess what I was also wondering, but failed to write was this -- timeout of 0 isn't some special high-priority event that gets queued up in the event queue. Now after I write that, it feels obvious - if it was, then the timeout case would always be firing.
01-20-2022 09:46 AM
Note: I think WavePacket is talking about this kind of structure (here found in Messenger Library but usable anywhere). It is a feedback node of -1 from the Timeout case, and zero from all other event cases.
01-20-2022 11:27 AM
@drjdpowell wrote:
It is a feedback node of -1 from the Timeout case, and zero from all other event cases.
Most of my larger programs use similar techniques, except that I use a shift register. Most events decide if a timeout is needed or not, so that output is on the right. Not all are zero.
One very important adjustment to avoid event buildup is to set the event queue to 1 and disable panel locking.