Revert "Replace Execution Engine's mutex with std::recursive_mutex."

This reverts commit 1f502bd9d7, due to
GCC / MinGW's lack of support for C++11 threading.

It's possible this will go back in after we come up with a
reasonable solution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211401 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Zachary Turner
2014-06-20 21:07:14 +00:00
parent 5b8e73ef81
commit 91e18f7639
7 changed files with 71 additions and 69 deletions

View File

@ -28,9 +28,9 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/type_traits.h"
#include <iterator>
#include <mutex>
namespace llvm {
@ -45,7 +45,7 @@ class ValueMapConstIterator;
/// This class defines the default behavior for configurable aspects of
/// ValueMap<>. User Configs should inherit from this class to be as compatible
/// as possible with future versions of ValueMap.
template<typename KeyT, typename MutexT = std::recursive_mutex>
template<typename KeyT, typename MutexT = sys::Mutex>
struct ValueMapConfig {
typedef MutexT mutex_type;
@ -217,11 +217,11 @@ public:
ValueMapCallbackVH Copy(*this);
typename Config::mutex_type *M = Config::getMutex(Copy.Map->Data);
if (M)
M->lock();
M->acquire();
Config::onDelete(Copy.Map->Data, Copy.Unwrap()); // May destroy *this.
Copy.Map->Map.erase(Copy); // Definitely destroys *this.
if (M)
M->unlock();
M->release();
}
void allUsesReplacedWith(Value *new_key) override {
assert(isa<KeySansPointerT>(new_key) &&
@ -230,7 +230,7 @@ public:
ValueMapCallbackVH Copy(*this);
typename Config::mutex_type *M = Config::getMutex(Copy.Map->Data);
if (M)
M->lock();
M->acquire();
KeyT typed_new_key = cast<KeySansPointerT>(new_key);
// Can destroy *this:
@ -246,7 +246,7 @@ public:
}
}
if (M)
M->unlock();
M->release();
}
};