1. The above data from the device,
2. The collected data for processing, drawing,
Because data processing more more troublesome, my idea is to collect data separately for a thread, and then open a thread processing data, data acquisition fast until picking, data processing can take your time,
I use MFC, for multithreaded don't know, but also more urgent, this kind of circumstance is open two worker threads,
If someone has a similar example is better, thank you very much,
CodePudding user response:
Example multithreading is easy, there are many onlineCodePudding user response:
What do you think can, just gathering thread to handle need to exchange data between threads, can use a queue, etcCodePudding user response:
In so doing can definitely, if the collection of information in several as moderator said in the queue, about queue http://www.cnblogs.com/mfryf/archive/2012/08/09/2629992.html remember locking,In fact if you fast data acquisition, and processing don't try so hard, it can also be a thread
CodePudding user response:
A thread to collect images, then there is A need to deal with image, to open A thread B, was introduced into the image on A thread to deal with BCodePudding user response:
Generally speaking, a thread is needed to collect data, and data processing depends on the actual situation, if is complicated but it doesn't take, there is no need to open a thread, if it is very time consuming, that is about to start threads,Data processing without time-consuming, then can be finished on the acquisition of the thread, can also be put into the queue and then in the main thread processing, can also send a message to the main window, processing processing data in the message)
If it is a very time consuming, use a separate thread to handle, when the need to pay attention to thread synchronization problem, this is the place where the most important thing to notice,
As for how to create a thread, is the most basic CreateThread (), to search on the net a lot
CodePudding user response: