In main
, I give the user the ability to enter a command to stop the application:
while( run_processes && cin >> command_line_input ){
I'd also like to stop the application elsewhere by setting run_processes = false;
.
However, when I set run_processes
to false
, the above loop doesn't stop without the user entering input.
How can I properly interrupt the loop without the user entering input?
run_processes
is properly being set. Doescin
not necessarily depend upon user input for thewhile
to proceed? Thank you so much in advance! – user1382306cin >> command_line_input
(and then send the string to the main thread), then you can decide in the main thread not to wait for thread reading fromcin
. I don't think it's possible to abort thecin >> command_line_input
call itself in a portable way. – pts