LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Asynchronous call with sub-vi dependicies

Solved!
Go to solution

I have a program where my main VI is starting multiple instances of a different VI asynchronously, and not waiting for the results. In this "different VI" there are many layers of sub-VI's. Do I need at have all sub-VI's start asynchronously as well? Or does simply starting the "different VI" asynchronously suffice?

 

I am worried that the multiple instances of the "different VI" will have to compete/wait for access to any of its sub-VI's.

 

Thanks in advance.

0 Kudos
Message 1 of 8
(2,806 Views)
Solution
Accepted by topic author Bolson785

If the SubVIs are non-reentrant, then the instances of the "different VI" will have to do some waiting because each non-reentrant subVIs can only serve one caller at a time.  However if the SubVIs are reentrant, clone instances of them can be called simultaneously by the instances of the "different VI".

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 8
(2,791 Views)

That's what I suspected. Will there be any issues with re-entrant subVI's returning data to the wrong instance of the calling "different VI" ?

0 Kudos
Message 3 of 8
(2,787 Views)

@Bolson785 wrote:

That's what I suspected. Will there be any issues with re-entrant subVI's returning data to the wrong instance of the calling "different VI" ?


No.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 8
(2,780 Views)

@Bolson785 wrote:

That's what I suspected. Will there be any issues with re-entrant subVI's returning data to the wrong instance of the calling "different VI" ?


No. 

"If you weren't supposed to push it, it wouldn't be a button."
Message 5 of 8
(2,730 Views)

I bet you could create such a problem for yourself if the VI used some named queue and send it back so both calls picked out the answers from the queue but in wrong order ... but as you can see you basically would have to try deliberately.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 6 of 8
(2,725 Views)

@Yamaeda wrote:

I bet you could create such a problem for yourself if the VI used some named queue and send it back so both calls picked out the answers from the queue but in wrong order ... but as you can see you basically would have to try deliberately.

/Y


It was just last month that my boss wanted to introduce a named queue and I recoiled from the idea because of just that complication. Now if the name of the named queue is derived from the VI that created same, we side-step yet another disaster waiting to happen.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 8
(2,723 Views)

I can imagine it can happen, but I've never had it happen to me and I use named queues every so often. Then, it's rarely many queues and the systems are usually not very large.

As a side note that possibly will make you cringe, the garbage collection in G# is based on named queues. 😉 Objects are kept track of in queues named after the class, it's worked quite well for 8 years. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 8
(2,678 Views)