11-09-2007 06:08 PM
FakStory wrote:
I tried to isolate the problem and it disapeared, ... it is probably a race condition...
11-10-2007 04:27 PM
11-11-2007 03:36 PM
11-12-2007 05:59 PM - edited 11-12-2007 06:04 PM
Hi FakStory,
The Event Structure itself only requires one Value Change event to execute regardless of any type of race conditions that may be present in your code. Events are queued and will be executed by the Event Structure as soon as your code reaches one. If you’d like to test how many times the Event Structure is executing the “stop”: Value Change event, I would recommend the following snippet of code. This will verify whether the event is executing more than once.
It sounds like you’re program is getting stuck elsewhere before you reach the event structure. I would check other parts of your code that depend on the “stop” button and occur sequentially before the snippet of code you provided.
Since you are using “Switch When Released” mechanical action, it is necessary to synchronize the rest of your code with this behavior. The Value Change event will fire on a change to True or False, but Local Variables may depend on a True case or False case to obtain the correct result elsewhere.
Another easy thing you could do is add a breakpoint on a line wired into your Event Structure. This will allow you to see if your code is getting to this point when you hit the stop button only one time. If it does not, you know your code is hanging elsewhere.
Regards,
Mike L