Thread-safe version of OutputCapturer
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include "../include/OutputCapturer.h"
|
||||
|
||||
std::ostringstream OutputCapturer::stream;
|
||||
boost::mutex mMutex;
|
||||
|
||||
Reference in New Issue
Block a user