"Busy Wait Fix Attempt with Thread.Sleep"

private static string userInput;

private static void Example() {
	userInput = null;
	GetUserInput(); // tells the UI to request user input on the UI thread
	
	while (userInput == null) { // wait for user input
		Thread.Sleep(100);
	}
	
	ProcessUserInput(userInput); // now use that input
}


Code snippet taken from "Common Multithreading Mistakes in C# - IV: Everything Else".