summaryrefslogtreecommitdiff
path: root/cpp/src/IceUtil/StaticMutex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceUtil/StaticMutex.cpp')
-rw-r--r--cpp/src/IceUtil/StaticMutex.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/cpp/src/IceUtil/StaticMutex.cpp b/cpp/src/IceUtil/StaticMutex.cpp
index 091aa5035f4..3e326a8f173 100644
--- a/cpp/src/IceUtil/StaticMutex.cpp
+++ b/cpp/src/IceUtil/StaticMutex.cpp
@@ -50,8 +50,13 @@ Init::Init()
Init::~Init()
{
- for_each(_criticalSectionList->begin(), _criticalSectionList->end(),
- DeleteCriticalSection);
+ for(list<CRITICAL_SECTION*>::iterator p = _criticalSectionList->begin();
+ p != _criticalSectionList->end(); ++p)
+ {
+ DeleteCriticalSection(*p);
+ delete *p;
+ }
+
delete _criticalSectionList;
DeleteCriticalSection(&_criticalSection);
}
@@ -66,9 +71,10 @@ void IceUtil::StaticMutex::initialize() const
EnterCriticalSection(&_criticalSection);
if(!_mutexInitialized)
{
- InitializeCriticalSection(&_mutex);
+ _mutex = new CRITICAL_SECTION;
+ InitializeCriticalSection(_mutex);
_mutexInitialized = true;
- _criticalSectionList->push_back(&_mutex);
+ _criticalSectionList->push_back(_mutex);
}
LeaveCriticalSection(&_criticalSection);
}