locking of input_buffer
This commit is contained in:
parent
70543edbb8
commit
11c7ee4593
1 changed files with 4 additions and 0 deletions
|
@ -88,6 +88,8 @@ int console::wait_char(const int timeout_ms)
|
||||||
|
|
||||||
void console::flush_input()
|
void console::flush_input()
|
||||||
{
|
{
|
||||||
|
std::unique_lock<std::mutex> lck(input_lock);
|
||||||
|
|
||||||
input_buffer.clear();
|
input_buffer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,6 +231,8 @@ void console::operator()()
|
||||||
else if (running_flag == false && c == 12) // ^l
|
else if (running_flag == false && c == 12) // ^l
|
||||||
refresh_virtual_terminal();
|
refresh_virtual_terminal();
|
||||||
else {
|
else {
|
||||||
|
std::unique_lock<std::mutex> lck(input_lock);
|
||||||
|
|
||||||
input_buffer.push_back(c);
|
input_buffer.push_back(c);
|
||||||
|
|
||||||
have_data.notify_all();
|
have_data.notify_all();
|
||||||
|
|
Loading…
Add table
Reference in a new issue