12-20-2013 02:27 PM
I am working on some legacy code and it contains a couple custom queue handling vi's that basically allow handling of the queue functions pretty nicely. While I pretty much understand whats going on, the one thing that is stumping me is the preservation of the data from execution to execution as these do not use wires to tie the instances of the vi's together.
Execution is set up to use "Preallocated clone reentrant execution" which, according to LV help, allows each pre-created clones to retain the data in the controls and uninitialized Shift Registers, respectively. That is to say, that each clone retains only it's own information and does not share that data with other clones (the way I read it)
What is confusing me then is that, if each call gets it's own clone, how would the data be shared between clones since they are all basically part of the same queue group?
I have attached the vi and associated ctrl's here and it's no emergency but I would like to wrap my head around this so I better understand what is happening and can then enhance it or use the techniques in other areas.
Thanks
12-20-2013 03:09 PM
The only thigns on your USRs are references to named queues. EVERY reference to a named queue will return a reference to the exact same memory location that the queue data lives in.
That's why naming a queue can get dangerous- someone else might use the same name and really cause you trouble. Or worse, decide to override your great handeling by grabbing a ref to your queue and messing with your data. If you decide to continue on this route- get a stronger name on that queue. UI Queue is a bit generic
12-23-2013 07:31 AM
The Name. I see now. I agree with your input on the naming convention. This is older code that I inherited and since it works well, wanted to keep using it but needed to understand that one function of it.
I will make adjustments to the naming to make it more specific to the application accordingly.
One other question on queues in general, I always almost always see the datatype for a queue as a Variant along with a State Control typedef contained in a cluster. I am expecting that you can use more than two items in a cluster and that you could have more than two variant items. Are there any limits to how many fields the data cluster can contain ?
Just thinking ahead for ideas to provide more control to certain apps with less clutter.
Thanks.....
12-23-2013 08:15 AM
No limits other than that you need memory to store the data. (So try to keep it under 2Gbytes OK?)