X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Flogging.cpp;h=dea333e534489b78bae632da28ccad90c56e35bd;hp=49b7d5828359962dcc0f4fbdc274865c783c826d;hb=b9a3a67e4bb39b769ac580d8d2f76eef6458f5d6;hpb=b51310723cafcb7ab805ed528eb29fb4402d6d43 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();