Use the Semaphore VIs located on the Functions»Advanced»Synchronization»Semaphore VIs palette to limit the number of tasks that may simultaneously operate on a shared (protected) resource. A protected resource or critical section might include writing to global variables or communicating with external instruments.
Click the icons for VI descriptions.
Acquire Semaphore | Get Semaphore Status |
Create Semaphore | Not A Semaphore |
Destroy Semaphore | Release Semaphore |
You can use the Semaphore VIs to synchronize two or more separate, parallel tasks so that only one task at a time executes a critical section of code protected by a common semaphore. In particular, use these VIs when you want other VIs or parts of block diagram to wait until another VI or part of a block diagram is finished with the execution of a critical section.
Refer to the Using LabVIEW to Create Multithreaded VIs for Maximum Performance and Reliability Application Note for more information about using semaphores to protect access to shared resources.