From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

access class object in multiple threads

Solved!
Go to solution

Hi!

I realized that objects are by value, so how to realize my problem? I can not figure out how to get the reference to my object.

BR / Thomas

lv1.PNG

0 Kudos
Message 1 of 4
(2,346 Views)
Solution
Accepted by topic author Thomas_J

Search for "DVR" and "LVOOP".

 

There are plenty of discussions on teh topic.

 

Shane.

Message 2 of 4
(2,343 Views)

OOP in LabVIEW not based on by reference like in c++, but is based on by value. 

So you will not be able to get any reference to your OOP object.

 

So what is happening in your code, is that a the fork of the object wire your are creating to copies of your object.

One thing you could do is have DVR in the private data of the class. Make a method that initialize the DVR, and call that method before the fork.

The in your read/write method, make use of the DVR to share the data.

Message 3 of 4
(2,327 Views)

Thanks to both of you!

It took me some time to get it all right but now it works.

So I now have to redefine all my inputs and outputs for the class functions.

If I understand it correctly, there are no 'new vi from template' for creating read/write vi.s for classes with DVR.

/thomas

0 Kudos
Message 4 of 4
(2,317 Views)