Fixed a build problem when there were headers
[oota-llvm.git] / include / llvm / Support / Mutex.h
index edd258d2fcb5d648418f03e655c76fe54b8f57a0..97dd5011532238c8c2df8bd314eb3e14948d90c6 100644 (file)
@@ -1,4 +1,4 @@
-//===- llvm/System/Mutex.h - Mutex Operating System Concept -----*- C++ -*-===//
+//===- llvm/Support/Mutex.h - Mutex Operating System Concept -----*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_SYSTEM_MUTEX_H
-#define LLVM_SYSTEM_MUTEX_H
+#ifndef LLVM_SUPPORT_MUTEX_H
+#define LLVM_SUPPORT_MUTEX_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Threading.h"
 #include <cassert>
 
@@ -75,8 +76,8 @@ namespace llvm
     /// @name Do Not Implement
     /// @{
     private:
-      MutexImpl(const MutexImpl & original);
-      void operator=(const MutexImpl &);
+      MutexImpl(const MutexImpl &) LLVM_DELETED_FUNCTION;
+      void operator=(const MutexImpl &) LLVM_DELETED_FUNCTION;
     /// @}
     };
 
@@ -85,16 +86,17 @@ namespace llvm
     /// indicates whether this mutex should become a no-op when we're not
     /// running in multithreaded mode.
     template<bool mt_only>
-    class SmartMutex : public MutexImpl {
+    class SmartMutex {
+      MutexImpl impl;
       unsigned acquired;
       bool recursive;
     public:
       explicit SmartMutex(bool rec = true) :
-        MutexImpl(rec), acquired(0), recursive(rec) { }
+        impl(rec), acquired(0), recursive(rec) { }
 
-      bool acquire() {
+      bool lock() {
         if (!mt_only || llvm_is_multithreaded()) {
-          return MutexImpl::acquire();
+          return impl.acquire();
         } else {
           // Single-threaded debugging code.  This would be racy in
           // multithreaded mode, but provides not sanity checks in single
@@ -105,9 +107,9 @@ namespace llvm
         }
       }
 
-      bool release() {
+      bool unlock() {
         if (!mt_only || llvm_is_multithreaded()) {
-          return MutexImpl::release();
+          return impl.release();
         } else {
           // Single-threaded debugging code.  This would be racy in
           // multithreaded mode, but provides not sanity checks in single
@@ -119,9 +121,9 @@ namespace llvm
         }
       }
 
-      bool tryacquire() {
+      bool try_lock() {
         if (!mt_only || llvm_is_multithreaded())
-          return MutexImpl::tryacquire();
+          return impl.tryacquire();
         else return true;
       }
 
@@ -139,11 +141,11 @@ namespace llvm
 
     public:
       SmartScopedLock(SmartMutex<mt_only>& m) : mtx(m) {
-        mtx.acquire();
+        mtx.lock();
       }
 
       ~SmartScopedLock() {
-        mtx.release();
+        mtx.unlock();
       }
     };