LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Persistent copy of a reference?

Is there a way to make persistent copy of a reference to any VI Server object?

Consider this code (it is simplified idea of what I'm trying to archieve):

refnum copy.png

 

If I close reference in one process, it becomes invalid in other. Is there any way to prevent this? I mean - any simple way, something like SpecialPersistentCopyMakerMegaSecretStuff.vi, hidden somewhere in vi.lib?

0 Kudos
Message 1 of 4
(3,100 Views)

try to create a refnum for reference.

or try the VI server reference



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 2 of 4
(3,090 Views)

Could you elaborate on this a bit more? What do you mean by "creating refnum for reference"?

0 Kudos
Message 3 of 4
(3,068 Views)

@PiDi wrote:

Is there any way to prevent this? I mean - any simple way, something like SpecialPersistentCopyMakerMegaSecretStuff.vi, hidden somewhere in vi.lib?


No.

 

 

The question shouldn't actually extend to all VI server references, because for many of them, the close primitive actually does nothing. But let's extend the question to references in general (queue refs, etc.) and then you have some options:

 

  1. Open a new reference to the same resource for each process. In this case, closing the last reference is generally what releases the resource. This is not possible with all APIs (DVRs, for instance).
  2. Do reference counting. That's a common way for managing something like this. Essentially, it's similar to what I described in the previous option, but you do it yourself. The basic idea is that each process that wants to use a reference tells a manager about it and the manager increments the counter. Every process that's done tells the manager and then it decrements it. When it reaches zero, the resource can be released. This manager can be a separate process, a functional global, etc. You can read up on ref counting to see more.

___________________
Try to take over the world!
0 Kudos
Message 4 of 4
(3,066 Views)