Quote Originally Posted by high_flyer
Again, if the cpu stays in one thread, you don't need threads, as threads are used when you want other processes to work in parallel, i.e CPU switches between them.
As answer to what you said, here, is that you can't really know/ have control over what the CPU does so your statmet may or may not be true, depends on the system and your application.
That's not quite true. The setting and getting of his boolean variable will be an atomic instruction and hence thead-safe. He may need a mutex though if he has a function that sets/gets the value and then executes further statements that depend on the value not having changed.