LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

are there semaphores in CVI?

Are there builtin semaphores in CVI? Or alternatively, is it hard to use the semaphores in the SDK?
0 Kudos
Message 1 of 4
(4,316 Views)
If you are using CVI 5.5 or greater, then there is a set of multithreading functions in the Utility library. There are synchronization objects in there called ThreadLocks that are similar to semaphores. Also, there are more advanced, easier to use tools like thread safe variables, thread safe queues, and thread local variables that have built in synchronization features. See the multithreading examples (cvi\samples\utility\threading) and the Multithreading Overview (cvi\bin\MulithreadingOverview.pdf) for more information on multithreading and synchronization in CVI.

Oh, and you can use SDK multithreading and synchronization functions, but I think you will find CVI's native functions much, much easier and effective.

Best Regards,

Chris Matthews
Nat
ional Instruments
0 Kudos
Message 2 of 4
(4,316 Views)
Thanks-

I used thread locks for synchronization. Work out pretty good.

Lorrie
0 Kudos
Message 4 of 4
(4,316 Views)
Hi,

CVI has built-in multithreaded support but it does not have built-in semaphores. However it is relatively easy to use the semaphores provided by the Win32 SDK. The main functions you'll be using are CreateSemaphore, OpenSemaphore (if semaphore will be accessed across processes), WaitforSingleObject, and CloseSemaphore.

Good luck,
Azucena
NI
0 Kudos
Message 3 of 4
(4,316 Views)