If a variable that is being modified in a thread and is properly locked and unlocked using a mutex is read in a while loop in another thread how does one lock and unlock the mutex so that the while loop can read the value, is it even necessary?
I set a variable in a thread and check it in another thread using a while loop. How is the variable locked and unlocked for checking in the while loop condition?
Is the only reasonable way to do it, to have an additional variable that is used to run the while loop and set that to the value of the variable that needs locking/unlocking?