diff options
Diffstat (limited to 'contrib/epee/src/readline_buffer.cpp')
-rw-r--r-- | contrib/epee/src/readline_buffer.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/epee/src/readline_buffer.cpp b/contrib/epee/src/readline_buffer.cpp index 3865b565c..34835b80d 100644 --- a/contrib/epee/src/readline_buffer.cpp +++ b/contrib/epee/src/readline_buffer.cpp @@ -5,6 +5,7 @@ #include <unistd.h> #include <mutex> #include <condition_variable> +#include <boost/thread.hpp> static int process_input(); static void install_line_handler(); @@ -83,10 +84,17 @@ void rdln::readline_buffer::set_prompt(const std::string& prompt) int rdln::readline_buffer::process() { - std::unique_lock<std::mutex> lock(process_mutex); + process_mutex.lock(); if(m_cout_buf == NULL) + { + process_mutex.unlock(); + boost::this_thread::sleep_for(boost::chrono::milliseconds( 1 )); return 0; - return process_input(); + } + int count = process_input(); + process_mutex.unlock(); + boost::this_thread::sleep_for(boost::chrono::milliseconds( 1 )); + return count; } int rdln::readline_buffer::sync() |