So my problem is this, my program has a getline(cin, stringvar) within a while(true) loop and I want to do other tasks if getline doesn't have any input to read from cin, instead of just sitting there and blocking.
my first idea was to just run 2 threads, one repeating 'my_other_task()' over and over, and the other repeating getline(..), but I think this solution would be better in my case, if I could figure out how to solve this.
cout << "I am so busy" << endl;}
//What goes here?}
Any ideas on the correct way to do this?
(my initial guess was that since cin is an 'istream', I could use peek(), but it doesn't seem to work...)