I want to have a static boolean variable that can be altered by any of the threads based on the response of a remote API. What is a thread-safe way that one would recommend