LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquire semaphore timeout without losing spot in queue

Hi all,

 

I'm looking for help on how to handle acquiring a semaphore while maintaining the position in the queue to maintain FIFO of a multi unit test setup that shares resources.

 

What I'm doing now is using a long timeout, which I can't get out of if I would like to abort the test.

 

I would use a short timeout and put it in a loop, but I don't want the UUT to lose it's place in line.

 

Any ideas?

0 Kudos
Message 1 of 7
(2,966 Views)

use -1 timeout and just destroy the semaphore on abort.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 7
(2,956 Views)

"use -1 timeout and just destroy the semaphore on abort."

 

But that would squash the semaphore for the other UUT waiting for the resource to free up.

0 Kudos
Message 3 of 7
(2,953 Views)

Yes, it would. 

 

So, you are going to need to poll a semaphore.  Something tells me there is a better way to do this since there really is no means to signal a "Stop waiting" on semaphore BUT, you could write your own using a notifier or user event to cancel wait on semaphore.

 

Example_VI_BD.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 7
(2,931 Views)

Hmm. Interesting question.

 

I posted an idea about having occurrences linked to the timeout functionality of such functions allowing for aborting the waits.

 

Go HERE and vote for it if you want a solution to your problem.

 

This idea would allow you to have a seperate parallel loop terminate the wait by setting an occurrence.  Leaving the wait running until you actually need to stop it would prevent your primitive "losing its palce in the queue".

 

Shane.

0 Kudos
Message 5 of 7
(2,922 Views)

@JÞB wrote:

Yes, it would. 

 

So, you are going to need to poll a semaphore.  Something tells me there is a better way to do this since there really is no means to signal a "Stop waiting" on semaphore BUT, you could write your own using a notifier or user event to cancel wait on semaphore.

 


I was hoping to avoid polling the semaphore because it would violate my FIFO process, and could possibly extend test time on a UUT if it keeps getting bumped to the end of the line.

 

I appreciate you putting that together.

0 Kudos
Message 6 of 7
(2,909 Views)

@Intaris wrote:

Hmm. Interesting question.

 

I posted an idea about having occurrences linked to the timeout functionality of such functions allowing for aborting the waits.

 

Go HERE and vote for it if you want a solution to your problem.

 

This idea would allow you to have a seperate parallel loop terminate the wait by setting an occurrence.  Leaving the wait running until you actually need to stop it would prevent your primitive "losing its palce in the queue".

 

Shane.


It's got my vote.  Seems like that would work for this situation.  Thanks for putting forth that idea.

0 Kudos
Message 7 of 7
(2,905 Views)