Well,
I tried what I just described and...
it almost worked ! It's just that this way, you can't update the toplevel menu, since its reference would have to be shared between the two loops, and this doesn't seem to work (remember the change in LV 7, that forced to use shift registers for menu refnum ?).
I am still stuck with my hidden control to get an event recognized within the main loop...
X.


Xavier Michalet wrote:

Hi Georges,

thanks for your time. I am a bit puzzled by the while loop without a "Wait" in your example, but I checked (Profile Vi) that indeed, since the reentrant Vi was in a sense hanging on as long as nothing is enqueued, this while loop was also hanging on for ever doing nothing. I also separated the two loops, one [firing events] that I put a "sublevel Vi" (the equivalent of my dynamically lanched Vi) and the other [responding to events] remaining in the top level vi. Works like a charm, even though I don't understand the timeout feature. I think I am going to use it, and each subViN (see my first post) will have the firing events loop in it.
But overall, this example doesn't use the Event Handler on the [respond to events] side...


Best,
X.

George Gatling (Contractor) wrote:

The way I manage my queues is maybe a little eccentric.... i create a reentrant subvi for each queue I want to use in my application. I name this queue the same name as the subvi (using a property node for the VI), and the subvi has an input to specify whether to enque or deque (it also has data in, data out and timeout terminals). I put one instance of this vi in the deque loop with timeout set to -1. Then, wherever I want to enque data I drop instances of this subvi with the operation terminal set to enque. This has some memory overhead because an instance of the reentrant VI is created everywhere I use the queue, but that's ok for me because I prefer the readability and convenience. It is easy to see where data is getting into the queue be looking for instances of the queue subvi. With the queue timeout set to -1 the deque operation will suspend until data is placed in the queue... this is what makes this approach event driven. (And is what also creates the need for and exit command for the queue... there is no other way to stop the loop while it is suspended in the deque).

I will send an example by private mail.

George






Reply via email to