X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Flogging.cpp;h=dea333e534489b78bae632da28ccad90c56e35bd;hb=b804a6da858bd130a54a8c7ccafd085302a2b3e8;hp=49b7d5828359962dcc0f4fbdc274865c783c826d;hpb=b51310723cafcb7ab805ed528eb29fb4402d6d43;p=pulseview.git diff --git a/pv/logging.cpp b/pv/logging.cpp index 49b7d58..dea333e 100644 --- a/pv/logging.cpp +++ b/pv/logging.cpp @@ -28,10 +28,13 @@ #include +using std::lock_guard; + namespace pv { Logging logging; +const int Logging::MIN_BUFFER_SIZE = 10; const int Logging::MAX_BUFFER_SIZE = 50000; Logging::~Logging() @@ -84,6 +87,8 @@ QString Logging::get_log() const void Logging::log(const QString &text, int source) { + lock_guard log_lock(log_mutex_); + if (buffer_.size() >= buffer_size_) buffer_.removeFirst();