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: 

skip subroutine if busy for normal priority

Solved!
Go to solution

I want to use the functionality of skip subroutine if busy for a normal priority sub.vi. Is there a way to do it?

 

This seems like a simple request, but I couldn't find it on the message boards. Sorry if it is there and I missed it.

0 Kudos
Message 1 of 8
(3,178 Views)

Hi LJ,

 

how do you determine if your "subVI is busy"?

How can it be busy when you want to call it?

 

Please explain what exactly you are trying to do!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(3,158 Views)

I have two parallel loops that call the same functional global variable. If the FGV takes awhile to finish I don't either loop to wait on it.

0 Kudos
Message 3 of 8
(3,150 Views)

@LJHerskowitz wrote:

If the FGV takes awhile to finish I don't either loop to wait on it.


1. What do you consider "a while"?

2. What all do you have in a FGV that it would take "a long time"?

 

#2 is mostly because anything that would take any decent amount of time should not (and likely cannot) be a subroutine anyways.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 8
(3,142 Views)

Yes something that takes awhile can't be a subroutine which is my problem. There are a lot of restrictions on what can be inside a subroutine.

 

I think if I go into details about what is inside the subVI that I want to skip if busy, it will change the conversation to a way to get around skipping a non subroutine if busy. And I'm really just curious if that is possible.

0 Kudos
Message 5 of 8
(3,125 Views)

Then I will make it simple and answer "NO". THat VI call option is only available for subroutines.

 

Alternatives?

 

Use semaphores?

 

Ben

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

I haven't played with semaphores before. It looks like semaphores could get the job done. I was thinking there would be a property node to see if the VI was currently busy.

0 Kudos
Message 7 of 8
(3,113 Views)
Solution
Accepted by topic author LJHerskowitz

I would say semaphores are your best best here.  Even if you had a property node, that would introduce some interesting race conditions.  What if you check to see if it was busy and then between you checking it was busy and actually calling it, the other process started running the subVI?  You are now stuck in exactly what you are trying to prevent.  And yes, things like this happen.  The specific condition I was told about (took a top-notch developer and one of the top LabVIEW R&D guys hours to find this race condition) involved checking for a queue reference to be valid and then using the queue.  They were actually getting an invalid reference error because the queue was destroyed by another process between the checking for the valid reference and then using the reference.

 

But the semaphore is simple to use and does the job.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 8
(3,105 Views)