summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_deadlock_detector.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2014-02-14 12:08:23 +0000
committerKostya Serebryany <kcc@google.com>2014-02-14 12:08:23 +0000
commit0c4fa9907ba77a1a803ca9f7da4cb09901951991 (patch)
tree9151c6554c655fb6b0a13bb57f1f869640516a7e /lib/sanitizer_common/sanitizer_deadlock_detector.h
parent097f7a0ea4878c395c9949b67f7aee59c134909f (diff)
[sanitizer] add iterators to bit vectors; make bit vector operations use little stack; add common flag 'detect_deadlocks'
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201405 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_deadlock_detector.h')
-rw-r--r--lib/sanitizer_common/sanitizer_deadlock_detector.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_deadlock_detector.h b/lib/sanitizer_common/sanitizer_deadlock_detector.h
index fcdc3f2e5..ed05c0d67 100644
--- a/lib/sanitizer_common/sanitizer_deadlock_detector.h
+++ b/lib/sanitizer_common/sanitizer_deadlock_detector.h
@@ -65,6 +65,7 @@ class DeadlockDetectorTLS {
// and one DeadlockDetectorTLS object per evey thread.
// This class is not thread safe, all concurrent accesses should be guarded
// by an external lock.
+// Not thread-safe, all accesses should be protected by an external lock.
template <class BV>
class DeadlockDetector {
public:
@@ -115,7 +116,7 @@ class DeadlockDetector {
// Handle the lock event, return true if there is a cycle.
// FIXME: handle RW locks, recusive locks, etc.
bool onLock(DeadlockDetectorTLS *dtls, uptr cur_node) {
- BV cur_locks;
+ BV &cur_locks = t1;
cur_locks.clear();
uptr cur_idx = nodeToIndex(cur_node);
for (uptr i = 0, n = dtls->numLocks(); i < n; i++) {
@@ -163,6 +164,7 @@ class DeadlockDetector {
BV recycled_nodes_;
BVGraph<BV> g_;
uptr data_[BV::kSize];
+ BV t1; // Temporary object which we can not keep on stack.
};
} // namespace __sanitizer