|
if you place the mouse on the chart, the chart update stops. |
Posted by SeonJu Kim on Oct-05-2020 13:32 |
|
I saw and made a realtime multi thread example in MFC.
When I move the mouse over it, the part of the chart picture update stops.
What is the cause
Please kindly advise and thank you so much in advance.
|
Re: if you place the mouse on the chart, the chart update stops. |
Posted by Peter Kwan on Oct-05-2020 15:40 |
|
Hi SeonJu Kim,
Are you code based on the "Multithreading Real-Time Chart" sample code in the Library section of our web site?
https://www.advsofteng.com/tutorials/extra.html
In the sample code, the mouse can move freely over the chart without any issue, and the track cursor can move as the mouse move.
For your case, there are many possibilities. For example, if your code do something in the mouse event handler that may affect the other thread with proper synchronization, it may cause some kind of deadlock or data corruption. If your other thread access any MFC controls (such as the CChartViewer control or any other control), it will cause problems too. It is because the mouse events occur in the main thread. If a control is accessed from the other thread while there is a mouse event, it will be accessed by two threads at the same time without proper synchronization, and this will cause problems.
In our sample code, the other thread never accesses the CChartViewer control or any MFC controls, so the code can run properly.
To further diagnose the problem, is it possible to provide an example that can reproduce the problem, so we can try it? May be you can make a simplify version of your code, and use random numbers as data, so we can try it.
Regards
Peter Kwan |
Re: if you place the mouse on the chart, the chart update stops. |
Posted by SeonJu Kim on Oct-06-2020 13:27 |
|
hi peter
I heard the answer that the 'thread' is the problem.
I thought the work was done.
I also brought 'randomwalk'.
I also used 'doublebufferedqueue.h'.
But still the same.
I put the source code I had written in the example document once.
It works perfectly!
I don't know what is the cause........
Thank you |
Re: if you place the mouse on the chart, the chart update stops. |
Posted by Peter Kwan on Oct-06-2020 22:26 |
|
Hi SeonJu,
If you can create a simple Visual Studio solution that can show the problem, I can try to trouble-shoot it to determine the cause.
Regards
Peter Kwan |
|