Thread-safe version of OutputCapturer

This commit is contained in:
Dmitry Panin
2013-11-19 03:58:43 +04:00
parent 331e126787
commit f370899a8a
3 changed files with 5 additions and 1 deletions

View File

@@ -5,13 +5,17 @@
#include <Qt>
#include <string>
#include <sstream>
#include "Threading.h"
class OutputCapturer
{
private:
static std::ostringstream stream;
static boost::mutex mMutex;
public:
static void add(const std::string& s) {
boost::mutex::scoped_lock lock(mMutex);
stream << s << "\n";
}
static void debugAndClear() {

View File

@@ -315,7 +315,6 @@ namespace boost
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include "../include/DebugRoutines.h"
#include "../include/JLogger.h"
namespace boost

View File

@@ -1,3 +1,4 @@
#include "../include/OutputCapturer.h"
std::ostringstream OutputCapturer::stream;
boost::mutex mMutex;