LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Repeated calls to acquire semaphore

The help file for acquire semaphore states: "Acquiring the same semaphore twice without an intervening call to Release Semaphore generally results in incorrect behavior, such as corrupted data values."

I thought that semaphores could be created with a size greater than 1, thus allowing the semaphore to be acquired multiple times before the semaphore is released. What does setting size to a value other than 1 do if the semaphore must be released before each subsequent call to Acquire Semaphore?

Thanks,
Jason
Jason Rolfe
0 Kudos
Message 1 of 2
(2,453 Views)
Hi Jason,

Normally semaphores are used to prevent multiple calls to for example an non-reentrant I/O-drive, hence the description in the help file.

There are no limitations in the actual semaphore VIs that prevents you from using a size greater than 1, as long as you specify it with the "Create Semaphore.vi".

Best regards,
Philip C.
National Instrument
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 2 of 2
(2,453 Views)