multithreading - C++ CLI multithread: std::cin text gets overriden by other threads output -


I have implemented a multithreaded C ++ 11 console and I have the following loop fetching commands:

  while (_valid) {/ * print 'Newline' with '& gt;' * / Cout & lt; & Lt; "\ R>"; If (cin.fail () || cin.eof ()) {cin.clear (); / * Reset Scenes State * /} / * Random Parser Function, Not Relevant * / _parse_cmd (_input); }  

Its a big problem: when I'm inputting a new command from the keyboard, if a thread is running on the background and that thread prints anything, then this is my current The keyboard will override the input and it will disappear, but my input will remain on cin buffer.

How can I redistribute the current keyboard output?


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -