From: maier Date: Tue, 23 Apr 2013 08:00:19 +0000 (+0000) Subject: Add the log_lock mutex to the three new method in LogStream that modify the stream X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=676c6347576a8435d20f08bd6f2a96fc820241d9;p=dealii-svn.git Add the log_lock mutex to the three new method in LogStream that modify the stream This ensures consistency of the simultaneous get and set procedure. git-svn-id: https://svn.dealii.org/trunk@29364 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/base/logstream.cc b/deal.II/source/base/logstream.cc index e0f7893465..7594dc2750 100644 --- a/deal.II/source/base/logstream.cc +++ b/deal.II/source/base/logstream.cc @@ -260,6 +260,8 @@ void LogStream::pop () std::ios::fmtflags LogStream::flags(const std::ios::fmtflags f) { + Threads::Mutex::ScopedLock lock(log_lock); + std::ios::fmtflags tmp = stream_flags; stream_flags = f; return tmp; @@ -269,6 +271,8 @@ LogStream::flags(const std::ios::fmtflags f) std::streamsize LogStream::precision (const std::streamsize prec) { + Threads::Mutex::ScopedLock lock(log_lock); + std::streamsize tmp = stream_precision; stream_precision = prec; return tmp; @@ -278,6 +282,8 @@ LogStream::precision (const std::streamsize prec) std::streamsize LogStream::width (const std::streamsize wide) { + Threads::Mutex::ScopedLock lock(log_lock); + std::streamsize tmp = stream_width; stream_width = wide; return tmp;