From 7ee2fe8a42102269b37467f3072b63065d6a850d Mon Sep 17 00:00:00 2001
From: "jar@chromium.org"
 <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 25 Nov 2009 22:30:23 +0000
Subject: [PATCH] Fix typo in recursion detection logic

When releasing the lock, I incorrectly set the thread owner for the lock
to the current thread, rather than resetting it to zero.  The result is that
some number of stacks were not being recorded into the stack map (because
the recursion blocking logic aborted the attempt to gather the lock).

If I ever do a recursive acquisition (i.e., my logic is faulty), then
an assertion will fire in the Acquire() for the lock.  This in turn
guarantees that when I Release() the lock, it was not a (windows
allowed) recursive acquisition of the lock, and hence the
thread owning the lock should indeed be zeroed.

r=mbelshe
Review URL: http://codereview.chromium.org/443009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33140 0039d316-1c4b-4281-b951-d872f2087c98
---
 tools/memory_watcher/call_stack.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/memory_watcher/call_stack.h b/tools/memory_watcher/call_stack.h
index 2c026bc1b06b4..aa3685d9d270f 100644
--- a/tools/memory_watcher/call_stack.h
+++ b/tools/memory_watcher/call_stack.h
@@ -84,7 +84,7 @@ class CallStack {
   }
 
   static void UnlockDbgHelp() {
-    active_thread_id_ = GetCurrentThreadId();
+    active_thread_id_ = 0;
     dbghelp_lock_.Release();
   }
 
-- 
GitLab