Protected changeable reads with mutex, switched flags atomically instead
of after computation