I am running a rather slow computation and I want to pause it. In the moment, I achieve that in a very sloppy manner:
First I split my GUI using _beginthread( GUIthread, 0, NULL );
With my GUIthread I pop up a window in the usual fashion and capture a button click from the user to modify a global variable bool Pause.
With the main thread I check at given stable points of the computation whether Pause is true. If it is true it is supposed to pause the program. If false it is supposed to resume. At the moment I do that in the sloppiest manner I can imagine (but it was the only one I came up with):
That means I must put my make my computational thread a not-main-thread. Will that slow down the thread's performance? My computations are supposed to be running for hours.
[Edit:] Did it exactly as you suggested! Thanks for the advice! Now I have to only figure out whether I lost performance...