I need all of my threads to check periodically that they should still be running, so that they can self-terminate when the program ends. For all but one of them, this is just a matter of checking a state variable, but the last one is a user-interaction thread, and its loop will wait indefinitely on user input, only checking the state variable when the user inputs an instruction. At this point the program fails anyway since the class can't operate properly when it's not running. Ideally, though, I'd like not to get to this point.
I'm thinking that the best solution, if possible, is a timeout on the getline, but in the event that it's not possible or a good option, I'm open to any option which will allow the thread to terminate neatly.
As an aside, I see a lot of mentions of std::getline. getline seems to work whether I use the namespace or not. Is one an alias of the other, and which is the proper one to use?
Thanks, Wyatt