LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

plotting DATA

Dear All,
I would like to run two threads simultaneously and I would like to
know what I should do to synchronize them. What I really need to do is
to have one thread execute a command when the other thread has reached
the end of its cycle.

Thanks you very much for your help,
David.

0 Kudos
Message 1 of 2
(2,605 Views)

CVI offers a set of commands for communications between threads.

Since the discussion  title refers to plotting data, I suppose your aim is to pass test results from one thread to the UI thread for it to plot them on the screen / save on disk. If so, you can use a thread safe queue between the threads installing a callback in the UI thread to handle data in the queue. By appropriately setting trigger mechanism you may be sure that the UI thread callback is called only when the correct amount of data is passed to the queue.

Another option is to call PostDeferredCall at the end of test cycle inside the test thread: the deferred function is executed in the main thread (that normally is the one that handles the user interface). The reverse mechanism is to use PostDeferredCallToThread or PostDeferredCallToThreadAndWait in the main thread to execute a function within the specified different thread.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(2,584 Views)