diff options
Diffstat (limited to 'cpp/src/Ice/GCRecMutex.cpp')
-rwxr-xr-x | cpp/src/Ice/GCRecMutex.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/cpp/src/Ice/GCRecMutex.cpp b/cpp/src/Ice/GCRecMutex.cpp new file mode 100755 index 00000000000..f4795d1daf4 --- /dev/null +++ b/cpp/src/Ice/GCRecMutex.cpp @@ -0,0 +1,51 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <Ice/GCRecMutex.h> + +namespace IceInternal +{ +GCRecMutex gcRecMutex; +} + +using namespace IceInternal; + +static int gcInitCount = 0; + +GCRecMutex::GCRecMutex() +{ + if(gcInitCount++ == 0) + { + _m = new IceUtil::RecMutex; + } +} + +GCRecMutex::~GCRecMutex() +{ + if(--gcInitCount == 0) + { + delete _m; + } +} + +GCRecMutexInit::GCRecMutexInit() +{ + if(gcInitCount++ == 0) + { + gcRecMutex._m = new IceUtil::RecMutex; + } +} + +GCRecMutexInit::~GCRecMutexInit() +{ + if(--gcInitCount == 0) + { + delete gcRecMutex._m; + } +} |