Thread-safe version of OutputCapturer
This commit is contained in:
@@ -5,13 +5,17 @@
|
|||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include "Threading.h"
|
||||||
|
|
||||||
class OutputCapturer
|
class OutputCapturer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static std::ostringstream stream;
|
static std::ostringstream stream;
|
||||||
|
static boost::mutex mMutex;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void add(const std::string& s) {
|
static void add(const std::string& s) {
|
||||||
|
boost::mutex::scoped_lock lock(mMutex);
|
||||||
stream << s << "\n";
|
stream << s << "\n";
|
||||||
}
|
}
|
||||||
static void debugAndClear() {
|
static void debugAndClear() {
|
||||||
|
|||||||
@@ -315,7 +315,6 @@ namespace boost
|
|||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include "../include/DebugRoutines.h"
|
|
||||||
#include "../include/JLogger.h"
|
#include "../include/JLogger.h"
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
#include "../include/OutputCapturer.h"
|
#include "../include/OutputCapturer.h"
|
||||||
|
|
||||||
std::ostringstream OutputCapturer::stream;
|
std::ostringstream OutputCapturer::stream;
|
||||||
|
boost::mutex mMutex;
|
||||||
|
|||||||
Reference in New Issue
Block a user