11-06-2018 10:13 PM
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
Solved! Go to Solution.
11-07-2018 06:41 AM
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.
11-07-2018 12:31 PM
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.