how to manage multi data input.
-
My project is about monitoring four sensor measurement from USB port. In each sensor give me the data for plot graph in the same client area. Because it is high speed input data (less than millisecond),so I separate each sensor data that I get in four thread and each thread use same client area to plot the graph. So,It possible in each thread will plot the graph on client area in the same time. My question is that when this occur the program will crash or not? if the answer is "crash". What about when I separate view in four view by splitter but same mainframe? if the answer still "crash". Please advise me the solution for this issue.
-
My project is about monitoring four sensor measurement from USB port. In each sensor give me the data for plot graph in the same client area. Because it is high speed input data (less than millisecond),so I separate each sensor data that I get in four thread and each thread use same client area to plot the graph. So,It possible in each thread will plot the graph on client area in the same time. My question is that when this occur the program will crash or not? if the answer is "crash". What about when I separate view in four view by splitter but same mainframe? if the answer still "crash". Please advise me the solution for this issue.
There can be a "crash" when multiple threads access the same resource. In your case it is the device context of the view. You must use a critical section to lock the drawing code so that a thread cannot draw to the DC till other threads have released it.
«_Superman_»
-
There can be a "crash" when multiple threads access the same resource. In your case it is the device context of the view. You must use a critical section to lock the drawing code so that a thread cannot draw to the DC till other threads have released it.
«_Superman_»
-
What about separate it to different process and different plot client area. Is it still crash ?
Then it will not because now there is no client areas being shared by multiple threads.
«_Superman_»
-
Then it will not because now there is no client areas being shared by multiple threads.
«_Superman_»