How do you pause a thread until a condition becomes true without busy waiting?
问题 How do you pause a thread until a condition becomes true without busy waiting? For example, suppose I'm checking to see whether playerOne.isWalking() Is going to be true and I want to run some code when it does become true. Again suppose playerOne is an instance of the class Player which then has the function isWalking(). I do not have access to the what makes isWalking() become true. So everytime I want to check to see if isWalking() is true, I have to call the method from an instance of