I have a thread with a while(1) loop in it. When the user push the stop button I would like that thread to end.
I thought about creating a bool and checking its value periodically in the thread and when I push the stop
button I change the value of the bool for that the thread breaks out of the loop and finishes.
Is it the best way to go about it, that's how professional programmers do it also?