diff options
author | Michi Henning <michi@zeroc.com> | 2003-10-22 04:06:06 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2003-10-22 04:06:06 +0000 |
commit | 5b0e003dbbe2556ba6d1f97e3d922b06fa9333df (patch) | |
tree | 194e137a2955e0bb09068a0277f2ef6da5cd3f22 /cpp/src/IceUtil/GCRecMutex.cpp | |
parent | Sun fixes (diff) | |
download | ice-5b0e003dbbe2556ba6d1f97e3d922b06fa9333df.tar.bz2 ice-5b0e003dbbe2556ba6d1f97e3d922b06fa9333df.tar.xz ice-5b0e003dbbe2556ba6d1f97e3d922b06fa9333df.zip |
*** empty log message ***
Diffstat (limited to 'cpp/src/IceUtil/GCRecMutex.cpp')
-rw-r--r-- | cpp/src/IceUtil/GCRecMutex.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/cpp/src/IceUtil/GCRecMutex.cpp b/cpp/src/IceUtil/GCRecMutex.cpp new file mode 100644 index 00000000000..736dccd764d --- /dev/null +++ b/cpp/src/IceUtil/GCRecMutex.cpp @@ -0,0 +1,53 @@ +// ********************************************************************** +// +// Copyright (c) 2003 +// ZeroC, Inc. +// Billerica, MA, USA +// +// All Rights Reserved. +// +// Ice is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License version 2 as published by +// the Free Software Foundation. +// +// ********************************************************************** + +#include <IceUtil/GCRecMutex.h> + +using namespace IceUtil; + +GCRecMutex IceUtil::gcRecMutex; + +static int gcInitCount = 0; + +GCRecMutex::GCRecMutex() +{ + if(gcInitCount++ == 0) + { + _m = new RecMutex; + } +} + +GCRecMutex::~GCRecMutex() +{ + if(--gcInitCount == 0) + { + delete _m; + } +} + +GCRecMutexInit::GCRecMutexInit() +{ + if(gcInitCount++ == 0) + { + gcRecMutex._m = new RecMutex; + } +} + +GCRecMutexInit::~GCRecMutexInit() +{ + if(--gcInitCount == 0) + { + delete gcRecMutex._m; + } +} |