LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel-E

Compound Close References

Status: New

When using extensive numbers of property and invoke nodes (for example, using the TestStand API) it's very common to end up with many references that need to be closed. This leads to structures like this:

 

closeref.PNG

 

It would be very convenient if we had a Compound Close References node that we could wire multiple references into. Since order often matters with closing references, the node could execute top-down once all references are available at the inputs. This would substantially clean up block diagrams and make API code a bit easier to follow. For example, the above code could just be replaced with:

 

compoundref.PNG

 

13 Comments
ouadji
Trusted Enthusiast

thank you very much Darren for this explanation.

 

pouce_levé.gif

JackDunaway
Trusted Enthusiast

+1, then generalizing: it'd be nice if all objects inherited from a common type, enabling any arbitrary objects to be arrayed, each implementing the Destruct (roughly, Close Reference) function interface defined by the root type.

 

The ability of this Destruct function to accept an array of objects is syntactic sugar, equivalent to an auto-indexed For loop that dispatches each concrete dtor serially.

 

(This can be generalized out to other APIs besides VI Server, including Queues, Files, VISA, ... the LabVIEW language is replete with object-oriented by-ref APIs that don't currently inherit from a common by-ref type ancestor.)

JKSH
Active Participant

> Would we not want this to close references from the bottom-up (lower-level to higher-level) in order to retain proper closing sequence? I rarely close refs by array since the closing sequence matters. Or does it? If I remember correctlly closing a higher-level reference before a lower-level wil cause an error message.

 

When it comes to closing Event Callback Refnums, doing it in the wrong order causes LabVIEW to freeze: http://forums.ni.com/t5/LabVIEW/BUG-Certain-code-paths-make-LabVIEW-deadlock-freeze-when/m-p/3299404 (technically, this is about Unregister for Event instead of Close Reference, but there are strong similarities)

Certified LabVIEW Developer