Lines Matching defs:dtls

195   void ensureCurrentEpoch(DeadlockDetectorTLS<BV> *dtls) {
196 dtls->ensureCurrentEpoch(current_epoch_);
202 bool onLockBefore(DeadlockDetectorTLS<BV> *dtls, uptr cur_node) {
203 ensureCurrentEpoch(dtls);
205 return g_.isReachable(cur_idx, dtls->getLocks(current_epoch_));
208 u32 findLockContext(DeadlockDetectorTLS<BV> *dtls, uptr node) {
209 return dtls->findLockContext(nodeToIndex(node));
212 // Add cur_node to the set of locks held currently by dtls.
213 void onLockAfter(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, u32 stk = 0) {
214 ensureCurrentEpoch(dtls);
216 dtls->addLock(cur_idx, current_epoch_, stk);
221 bool hasAllEdges(DeadlockDetectorTLS<BV> *dtls, uptr cur_node) {
222 uptr local_epoch = dtls->getEpoch();
227 for (uptr i = 0, n = dtls->getNumLocks(); i < n; i++) {
228 if (!g_.hasEdge(dtls->getLock(i), cur_idx))
240 uptr addEdges(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, u32 stk,
242 ensureCurrentEpoch(dtls);
245 uptr n_added_edges = g_.addEdges(dtls->getLocks(current_epoch_), cur_idx,
250 dtls->findLockContext(added_edges[i]), stk,
275 bool onLock(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, u32 stk = 0) {
276 ensureCurrentEpoch(dtls);
277 bool is_reachable = !isHeld(dtls, cur_node) && onLockBefore(dtls, cur_node);
278 addEdges(dtls, cur_node, stk, 0);
279 onLockAfter(dtls, cur_node, stk);
288 bool onTryLock(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, u32 stk = 0) {
289 ensureCurrentEpoch(dtls);
291 dtls->addLock(cur_idx, current_epoch_, stk);
295 // Returns true iff dtls is empty (no locks are currently held) and we can
297 // This operation is thread-safe as it only touches the dtls.
298 bool onFirstLock(DeadlockDetectorTLS<BV> *dtls, uptr node, u32 stk = 0) {
299 if (!dtls->empty()) return false;
300 if (dtls->getEpoch() && dtls->getEpoch() == nodeToEpoch(node)) {
301 dtls->addLock(nodeToIndexUnchecked(node), nodeToEpoch(node), stk);
307 // Finds a path between the lock 'cur_node' (currently not held in dtls)
310 uptr findPathToLock(DeadlockDetectorTLS<BV> *dtls, uptr cur_node, uptr *path,
312 tmp_bv_.copyFrom(dtls->getLocks(current_epoch_));
324 // This operation is thread-safe as it only touches the dtls.
325 void onUnlock(DeadlockDetectorTLS<BV> *dtls, uptr node) {
326 if (dtls->getEpoch() == nodeToEpoch(node))
327 dtls->removeLock(nodeToIndexUnchecked(node));
332 // This operation is thread-safe as it only touches the dtls
334 bool onLockFast(DeadlockDetectorTLS<BV> *dtls, uptr node, u32 stk = 0) {
335 if (hasAllEdges(dtls, node)) {
336 dtls->addLock(nodeToIndexUnchecked(node), nodeToEpoch(node), stk);
342 bool isHeld(DeadlockDetectorTLS<BV> *dtls, uptr node) const {
343 return dtls->getLocks(current_epoch_).getBit(nodeToIndex(node));