01-10-2012 08:44 AM
I'm trying to find a way of dynamically unregistering a timeout event from an event structure. In order to dynamically unregister an event I need to first dynamically register it and this is where I'm having problems.
I first create an application refnum, then I wire this as an input to the Register Events function. When I right click or drop-down on the event source input to the Register Events function 'timeout' appears in the list but is greyed out and not selectable.
Does anyone know why this is so?
Solved! Go to Solution.
01-10-2012 09:03 AM
You can't dynamically register or unregister a timeout event. However, you can very easily control the timeout value you wire to the event timeout terminal. If this value is -1, the timeout case will never be processed.
01-10-2012 10:19 AM
@Spruce wrote:
'timeout' appears in the list but is greyed out and not selectable.
Does anyone know why this is so?
As Jarrod explained their are much better ways (setting the TMO value with a SR is a lot more scaleable and flexable)
Having it greyed out prevents users from chosing a less scalable approach. Why its there in the first place is beyond me.
01-11-2012 07:42 AM
Thanks to both for your replies. Setting the timeout value was the approach I had been using but I was beginning to feel a bit uncomfortable that there might be unintended consequences.
Could you clear up one more point for me:
Assuming I have a timeout interval of, say, 10ms but my timeout event handler takes 50ms to execute, is there any possibility that one or more timeout events will already be waiting in the event queue and will trigger another unwanted call of my timeout event handler even though I write -1 to the timeout terminal before re-entering the event structure? I notice, for instance, that user events seem to stack up if generated faster than the event handler can process them.
01-11-2012 09:18 AM
No. I believe the timeout countdown only starts when the event structure starts executing.
01-11-2012 09:40 AM
Great, thanks.
01-11-2012 09:46 AM
@jarrod S. wrote:
No. I believe the timeout countdown only starts when the event structure starts executing.
More specifically, the timeout starts after all queued up events have completed.