LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquire next available semaphore from an identical group

Solved!
Go to solution

I have a test system that has several communication devices that can be used interchangeably.  Because this is a radio comm test, sometimes one device will not be communicating well so I need to have the ability to abandon one device and switch to the next available one.  Each device has its own semaphore and I want a way to wait on all of them but then acquire the first available device (semaphore) and forget the rest.  

I tried putting them in a loop and testing each one with a short timeout but I keep ending up with the loops from clones getting deadlocked with each other.  

For now I am taking the current device and rotating the list to the next index and waiting on that semaphore but that is not always going to be the next one available.  I am being held to a very tight timing requirement so I really need to find the next available semaphore.  

Another way to state the question is that I need to stop/abandon/abort waiting on a queue without destroying the queue.

I am using LabVIEW 2017

 

0 Kudos
Message 1 of 3
(2,401 Views)
Solution
Accepted by topic author itronChiraldude

My first question is "Why are you using Semaphores?"  They tend to be slow and in 99.9% cases not needed.  If you were using proper Queued Message Handlers (QMH), then you could just send a message to the QMH for a device and ask for its status.  If no reply, go on to the next one.


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 2 of 3
(2,374 Views)

No particular reason for choosing a semaphore.  Not that it would matter from efficiency standpoint as my test steps take 1-15 seconds.

Sounds like you are saying I need something much more sophisticated than a semaphore.

 

I suppose this is my first time running into a situation where the actor framework would be useful.  

No time to implement that for this project but I can create a VI that handles device requests via a queue and replies to the sender on a separate queue created by the sender.

 

0 Kudos
Message 3 of 3
(2,358 Views)