I want to do something like this
while (true) {
if (my_boolean) { //my_boolean is being updated by other threads
do something;
break;
}
do something else;
}
my problem is, my_boolean is being updated by another method in another thread. Sometimes such updates can be captured, sometimes not. Is there any consistent way to work around this?