Simple as the title states. Basically, in this example, could we ever get an invalid state:
var myBool = false
// Thread 1
while true {
if randomEvent() {
myBool = true
}
}
// Thread 2
while true {
if myBool {
print("Was set to true")
} else {
print("Not set")
}
}
Could this ever crash because myBool is in some invalid state? Or is this "safe"?