Using LabWindows/CVI Multithreading Functions
- Updated2023-02-21
- 1 minute(s) read
Using LabWindows/CVI Multithreading Functions
LabWindows/CVI includes functions that you can use to create multithreaded applications. The LabWindows/CVI multithreading functions provide the following performance optimizations over standard operating system threading functions:
- Thread pools help you schedule functions for execution in secondary threads. Thread pools handle thread caching to minimize the overhead associated with creating and destroying threads.
- Thread safe queues abstract passing data between threads. One thread can read from a queue at the same time that another thread writes to the queue.
- Thread safe variables combine your variable and an OS thread-locking object into a single entity. You can call a single function to acquire a thread lock, set the variable value, and release the thread lock.
- Thread locks prevent multiple threads from performing a specific action at the same time. Thread locks simplify using a critical section or mutex by providing a consistent API and by automatically choosing the appropriate mechanism when necessary. For example, LabWindows/CVI automatically uses a mutex if the lock needs to be shared between processes or if threads need to process messages while waiting for the lock. A critical section is used in other cases because it is more efficient.
- Thread local variables provide per-thread instances of variables. The operating system places a limitation on the number of thread local variables available to each process. The LabWindows/CVI implementation consolidates the thread local variables, using only one process thread local variable for all of the thread local variables in your program.
You can find all of the multithreading functions in the LabWindows/CVI Library Tree under Utility Library»Multithreading.