[Lldb-commits] [lldb] r164708 - in /lldb/branches/windows: include/lldb/Host/Mutex.h source/Host/common/Condition.cpp source/Host/common/Mutex.cpp
Carlo Kok
ck at remobjects.com
Wed Sep 26 10:17:52 PDT 2012
Author: carlokok
Date: Wed Sep 26 12:17:52 2012
New Revision: 164708
URL: http://llvm.org/viewvc/llvm-project?rev=164708&view=rev
Log:
Mutex does not need a new/dispose but can be used as-is
Modified:
lldb/branches/windows/include/lldb/Host/Mutex.h
lldb/branches/windows/source/Host/common/Condition.cpp
lldb/branches/windows/source/Host/common/Mutex.cpp
Modified: lldb/branches/windows/include/lldb/Host/Mutex.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/include/lldb/Host/Mutex.h?rev=164708&r1=164707&r2=164708&view=diff
==============================================================================
--- lldb/branches/windows/include/lldb/Host/Mutex.h (original)
+++ lldb/branches/windows/include/lldb/Host/Mutex.h Wed Sep 26 12:17:52 2012
@@ -264,7 +264,7 @@
#ifndef _POSIX_SOURCE
#ifdef _WIN32
- CRITICAL_SECTION* m_mutex;
+ CRITICAL_SECTION m_mutex;
#else
llvm::sys::MutexImpl m_mutex;
#endif
Modified: lldb/branches/windows/source/Host/common/Condition.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/Condition.cpp?rev=164708&r1=164707&r2=164708&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Condition.cpp (original)
+++ lldb/branches/windows/source/Host/common/Condition.cpp Wed Sep 26 12:17:52 2012
@@ -110,9 +110,8 @@
wait = wval;
}
-
-
- int err = SleepConditionVariableCS(&m_condition, mutex.m_mutex, wait);
+
+ int err = SleepConditionVariableCS(&m_condition, &mutex.m_mutex, wait);
if (timed_out != NULL)
{
Modified: lldb/branches/windows/source/Host/common/Mutex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/Mutex.cpp?rev=164708&r1=164707&r2=164708&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Mutex.cpp (original)
+++ lldb/branches/windows/source/Host/common/Mutex.cpp Wed Sep 26 12:17:52 2012
@@ -184,8 +184,7 @@
m_mutex()
{
#ifdef _WIN32
- m_mutex = new CRITICAL_SECTION();
- InitializeCriticalSection(m_mutex);
+ InitializeCriticalSection(&m_mutex);
#else
int err;
err = ::pthread_mutex_init (&m_mutex, NULL);
@@ -206,8 +205,7 @@
m_mutex()
{
#ifdef _WIN32
- m_mutex = new CRITICAL_SECTION();
- InitializeCriticalSection(m_mutex);
+ InitializeCriticalSection(&m_mutex);
#else
int err;
::pthread_mutexattr_t attr;
@@ -251,8 +249,8 @@
Mutex::~Mutex()
{
#ifdef _WIN32
- DeleteCriticalSection(m_mutex);
- delete m_mutex;
+ DeleteCriticalSection(&m_mutex);
+
#else
int err;
err = ::pthread_mutex_destroy (&m_mutex);
@@ -291,9 +289,9 @@
Mutex::Lock()
{
#ifdef _WIN32
- EnterCriticalSection(m_mutex);
+ EnterCriticalSection(&m_mutex);
return 0;
-#else
+#else
DEBUG_LOG ("[%4.4llx/%4.4llx] pthread_mutex_lock (%p)...\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), &m_mutex);
#if ENABLE_MUTEX_ERROR_CHECKING
@@ -327,7 +325,7 @@
Mutex::TryLock(const char *failure_message)
{
#ifdef _WIN32
- return 0 == TryEnterCriticalSection(m_mutex);
+ return 0 == TryEnterCriticalSection(&m_mutex);
#else
#if ENABLE_MUTEX_ERROR_CHECKING
error_check_mutex (&m_mutex, eMutexActionAssertInitialized);
@@ -352,7 +350,7 @@
Mutex::Unlock()
{
#ifdef _WIN32
- LeaveCriticalSection(m_mutex);
+ LeaveCriticalSection(&m_mutex);
return 0;
#else
#if ENABLE_MUTEX_ERROR_CHECKING
More information about the lldb-commits
mailing list