summaryrefslogtreecommitdiffstats
path: root/lib/System
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-06-18 17:53:17 +0000
committerOwen Anderson <resistor@mac.com>2009-06-18 17:53:17 +0000
commitb849a4dd4bee9ad17e295691087ce09e8d77d685 (patch)
treed8db21f0b4ae2c14aefdc587b06368c5278620bd /lib/System
parente53118ea32370b5c57c61ae5e8125883acfb641b (diff)
downloadexternal_llvm-b849a4dd4bee9ad17e295691087ce09e8d77d685.zip
external_llvm-b849a4dd4bee9ad17e295691087ce09e8d77d685.tar.gz
external_llvm-b849a4dd4bee9ad17e295691087ce09e8d77d685.tar.bz2
Insert a SmartMutex templated class into the class hierarchy, which takes a template parameter specifying whether this mutex
should become a no-op when not running in multithreaded mode. Make sys::Mutex a typedef of SmartMutex<false>, to preserve source compatibility. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73709 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System')
-rw-r--r--lib/System/Mutex.cpp20
-rw-r--r--lib/System/Unix/Mutex.inc10
-rw-r--r--lib/System/Win32/Mutex.inc10
3 files changed, 20 insertions, 20 deletions
diff --git a/lib/System/Mutex.cpp b/lib/System/Mutex.cpp
index d95c25b..a5e9920 100644
--- a/lib/System/Mutex.cpp
+++ b/lib/System/Mutex.cpp
@@ -23,11 +23,11 @@
// Define all methods as no-ops if threading is explicitly disabled
namespace llvm {
using namespace sys;
-Mutex::Mutex( bool recursive) { }
-Mutex::~Mutex() { }
-bool Mutex::acquire() { return true; }
-bool Mutex::release() { return true; }
-bool Mutex::tryacquire() { return true; }
+MutexImpl::MutexImpl( bool recursive) { }
+MutexImpl::~MutexImpl() { }
+bool MutexImpl::acquire() { return true; }
+bool MutexImpl::release() { return true; }
+bool MutexImpl::tryacquire() { return true; }
}
#else
@@ -55,7 +55,7 @@ using namespace sys;
static const bool pthread_enabled = true;
// Construct a Mutex using pthread calls
-Mutex::Mutex( bool recursive)
+MutexImpl::MutexImpl( bool recursive)
: data_(0)
{
if (pthread_enabled)
@@ -94,7 +94,7 @@ Mutex::Mutex( bool recursive)
}
// Destruct a Mutex
-Mutex::~Mutex()
+MutexImpl::~MutexImpl()
{
if (pthread_enabled)
{
@@ -106,7 +106,7 @@ Mutex::~Mutex()
}
bool
-Mutex::acquire()
+MutexImpl::acquire()
{
if (pthread_enabled)
{
@@ -120,7 +120,7 @@ Mutex::acquire()
}
bool
-Mutex::release()
+MutexImpl::release()
{
if (pthread_enabled)
{
@@ -134,7 +134,7 @@ Mutex::release()
}
bool
-Mutex::tryacquire()
+MutexImpl::tryacquire()
{
if (pthread_enabled)
{
diff --git a/lib/System/Unix/Mutex.inc b/lib/System/Unix/Mutex.inc
index 4a015a6..10e7ecb 100644
--- a/lib/System/Unix/Mutex.inc
+++ b/lib/System/Unix/Mutex.inc
@@ -20,28 +20,28 @@ namespace llvm
{
using namespace sys;
-Mutex::Mutex( bool recursive)
+MutexImpl::MutexImpl( bool recursive)
{
}
-Mutex::~Mutex()
+MutexImpl::~MutexImpl()
{
}
bool
-Mutex::acquire()
+MutexImpl::MutexImpl()
{
return true;
}
bool
-Mutex::release()
+MutexImpl::release()
{
return true;
}
bool
-Mutex::tryacquire( void )
+MutexImpl::tryacquire( void )
{
return true;
}
diff --git a/lib/System/Win32/Mutex.inc b/lib/System/Win32/Mutex.inc
index 7c1723b..75f01fe 100644
--- a/lib/System/Win32/Mutex.inc
+++ b/lib/System/Win32/Mutex.inc
@@ -22,13 +22,13 @@
namespace llvm {
using namespace sys;
-Mutex::Mutex(bool /*recursive*/)
+MutexImpl::MutexImpl(bool /*recursive*/)
{
data_ = new CRITICAL_SECTION;
InitializeCriticalSection((LPCRITICAL_SECTION)data_);
}
-Mutex::~Mutex()
+MutexImpl::~MutexImpl()
{
DeleteCriticalSection((LPCRITICAL_SECTION)data_);
delete (LPCRITICAL_SECTION)data_;
@@ -36,21 +36,21 @@ Mutex::~Mutex()
}
bool
-Mutex::acquire()
+MutexImpl::acquire()
{
EnterCriticalSection((LPCRITICAL_SECTION)data_);
return true;
}
bool
-Mutex::release()
+MutexImpl::release()
{
LeaveCriticalSection((LPCRITICAL_SECTION)data_);
return true;
}
bool
-Mutex::tryacquire()
+MutexImpl::tryacquire()
{
return TryEnterCriticalSection((LPCRITICAL_SECTION)data_);
}