summaryrefslogtreecommitdiff
path: root/cppe/test/Common/TestCommon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cppe/test/Common/TestCommon.cpp')
-rwxr-xr-xcppe/test/Common/TestCommon.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/cppe/test/Common/TestCommon.cpp b/cppe/test/Common/TestCommon.cpp
index 3d8f03a0dfb..111bc6d5468 100755
--- a/cppe/test/Common/TestCommon.cpp
+++ b/cppe/test/Common/TestCommon.cpp
@@ -20,6 +20,8 @@
using namespace std;
using namespace Ice;
+static IceUtil::StaticMutex globalMutex = ICE_STATIC_MUTEX_INITIALIZER;
+
class LoggerI : public Logger
{
public:
@@ -27,21 +29,23 @@ public:
virtual void
print(const string& message)
{
+ IceUtil::StaticMutex::Lock sync(globalMutex);
tprintf("%s\n", message.c_str());
}
virtual void
trace(const string& category, const string& message)
{
- string s = "[ ";
-#ifdef _WIN32
- {
- char buf[1024];
- sprintf(buf, "%ld", GetTickCount());
- s += buf;
- }
+ IceUtil::StaticMutex::Lock sync(globalMutex);
+ string s = "[ ";
+#ifdef _WIN32
+ {
+ char buf[1024];
+ sprintf(buf, "%ld", GetTickCount());
+ s += buf;
+ }
#else
- s += IceUtil::Time::now().toMilliSeconds();
+ s += IceUtil::Time::now().toMilliSeconds();
#endif
s += ' ';
@@ -63,12 +67,14 @@ public:
virtual void
warning(const string& message)
{
+ IceUtil::StaticMutex::Lock sync(globalMutex);
tprintf("warning: %s\n", message.c_str());
}
virtual void
error(const string& message)
{
+ IceUtil::StaticMutex::Lock sync(globalMutex);
tprintf("error: %s\n", message.c_str());
}
};