LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Thread Pools and Variable Scope

I'm developing an application that is capable of monitoring up to 4 COM Ports at the same time and I want to use multithreading to improve its performance. Depending on the application the use may only need to monitor all 4 com port. Each com port can be tured off it's not needed.

I've tried using a worker thread that used ComCallbacks for each port but it seemed that there was some blocking of the callbacks. The activity lights for 3 of the 4 com ports would indicate no activity while the 4th com port would still be active.

My plan is to develop a worker thread to contain all of the necessary data processing, error handling, local variables, etc for one com port. Then I want to create 4 thread pools, one for each com port. As
each com port is needed the thread function will be scheduled in the cooresponding thread pool.

Is this possible? What is the scope of the variables? Will the local variables in one thread pool affect the local variables in any of the other thread pools? I do plan on having a global variable, BOOL QuitThread[4] that will keep each thread open. This BOOL variable will be controlled by the GUI.

By making separate thread pools for each com port can I think of the threads running in each pool as independent entities, with their own local variables that can only be changed by threads running in the cooresponding pool?

Thanks
0 Kudos
Message 1 of 1
(2,827 Views)