LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you put InstallComCallback in a different thread?

I have a device that outputs data pretty regulary and it would be nice to process that data in a different thread. Right now I have InstallComCallback calling the thread, but I think this keeps starting and stopping the thread, so I was wondering if/how inside a thread you could use InstallComCallback so it didn't keep starting and stopping the thread.

Thanks
0 Kudos
Message 1 of 5
(3,457 Views)
Right now I got something to work if I:
Start Thread

In thread: I do InstallComCallback then loop ProcessSystemEvent and have the callback call a function to do all my data retrieval and processing.

The cpu usage went down, so I hope that means its running it in the thread.
0 Kudos
Message 2 of 5
(3,446 Views)
Nevermind, I think the cpu usage is about the same, so I don't know if it works or not.
0 Kudos
Message 3 of 5
(3,446 Views)
Hello Nick009,

When you call InstallComCallback, LabWindows/CVI will create a new thread with each callback. However, the new thread it creates is used for a background process. The callback will not be installed in the newly created thread. If you would like to install your this callback in a new thread please reference the example program below which shows how to install the callback in a new thread.

Using InstallComCallback in a Different Thread from the User Interface in LabWindows/CVI 5.5

Hope that helps.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 4 of 5
(3,434 Views)
Thanks for the example. I had almost figured it out and that finished off my questions.
0 Kudos
Message 5 of 5
(3,431 Views)