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".