I have an application where I am entering a while loop and looking at 2 things. The first is if a triggered event has occurred and the second is a user input to stop the loop. I have looked at several different things and can't find a good solution. I thought about using a thread but then if there is never a user input the thread will continue to run. Eventually, I want to send commands in using a socket but right now I am just trying to set everything up on the local machine. Is there any other way to check a stream (be it file or cin) with out pausing the overall operation of the application?