]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add the log_lock mutex to the three new method in LogStream that modify the stream
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 23 Apr 2013 08:00:19 +0000 (08:00 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 23 Apr 2013 08:00:19 +0000 (08:00 +0000)
This ensures consistency of the simultaneous get and set procedure.

git-svn-id: https://svn.dealii.org/trunk@29364 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/base/logstream.cc

index e0f789346578bc701dfb459dea14c94b1107c3d9..7594dc2750a4cf6b44e32db262f9b4fbb06079eb 100644 (file)
@@ -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;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.