LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Semaphor problem

I'm experiencing a problem in the management of the semaphores under LabVIEW 6.0.2.
Maybe the semaphore is acquired by one thread even if the "Acquire Sempahore" function times out. Since I do NOT release the semaphore when the function times out, the other threads are not able to gain access to the semaphore after this condition occurs for the first time.
I've searched the knowledge base and found a fix (document ID 2BT9TQ1P) consisting in a new SEMAPHOR.LLB file.
Unfortunately only LabVIEW 6.1 (still in beta?) is able to load this file.

Can someone help me?
Thank you!
0 Kudos
Message 1 of 2
(2,781 Views)
> I'm experiencing a problem in the management of the semaphores under
> LabVIEW 6.0.2.
> Maybe the semaphore is acquired by one thread even if the "Acquire
> Sempahore" function times out. Since I do NOT release the semaphore
> when the function times out, the other threads are not able to gain
> access to the semaphore after this condition occurs for the first
> time.
> I've searched the knowledge base and found a fix (document ID
> 2BT9TQ1P) consisting in a new SEMAPHOR.LLB file.
> Unfortunately only LabVIEW 6.1 (still in beta?) is able to load this
> file.
>


I'm not certain, but these do not sound like the same symptoms to me.
The bug described in the database is that more than one section of code
can gain the semaphore simultaneously. As the databas
e says, this is
uncommon and happens only if the semaphore is released when it has never
been acquired.

If you think this is happening in your application, you can avoid the
problem by being careful about all releases. Protect all releases with
the Boolean that tells you whether the acquire worked or timed out.
Only release it if acquired. The way I understand it, this avoids the
bug completely.

To determine if this is happening or something else, it is sometimes
nice to make a wrapper VI around the semaphore so that the acquisition,
timeout, and releases are logged to an array, a file, or whatever. You
can also add an input "name" to help distinguish the different callers.
If the app gets hung up, then you can open the file or the array and
look at how it got that way. More than likely, there is a way for a
subVI to finish without releasing the semaphore. The simpler you can
make the code and logic between the acquire and release, the less likely
for this to hap
pen.

Greg McKaskle
0 Kudos
Message 2 of 2
(2,781 Views)