ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  stop thread
Posted by isan on Dec-15-2018 01:31
Hi ,in these c++ sample codes
https://www.advsofteng.com/tutorials/real_time_chart_multithread/real_time_chart_multithread.html

dataSource->start();

this line start the thread ? how can to stop the thread?

  Re: stop thread
Posted by Peter Kwan on Dec-15-2018 16:12
Hi isan,

In the "Multithreading Real-Time Chart" sample code, we implemented a random number generator RandomWalk that generates a random walk sequence in a separate thread. It is started using dataSource->start(); and can be stopped using dataSource->stop();. The RandowWalk destructor will also stop the thread if it is running. Therefore deleting the dataSource object will stop the thread.

In your real application, it is expected you will use some real data source, not the RandomWalk. However, if you are interested in how RandomWalk works (including how to create and destroy threads), you may refer to "randomwalk.h" and "randomwalk.cpp".

Regards
Peter Kwan