Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: chrome/app/chrome_exe_main_win.cc

Issue 10908279: Schedule an APC to trigger the thread cap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_exe_main_win.cc
===================================================================
--- chrome/app/chrome_exe_main_win.cc (revision 157020)
+++ chrome/app/chrome_exe_main_win.cc (working copy)
@@ -21,8 +21,10 @@
public:
static void NTAPI UpdateCount(PVOID module, DWORD reason, PVOID reserved) {
if (reason == DLL_THREAD_ATTACH) {
+ // We hit the threshold, but the loader would eat an exception fired now.
+ // So schedule an APC to fire the exception once loading is done.
if (::InterlockedIncrement(&count_) > cap_)
- __debugbreak();
+ ::QueueUserAPC(CrashProcessCallback, ::GetCurrentThread(), NULL);
} else if (reason == DLL_THREAD_DETACH) {
::InterlockedDecrement(&count_);
}
@@ -31,8 +33,10 @@
static void SetCap(LONG cap) { cap_ = cap; }
private:
- static LONG volatile count_;
- static LONG volatile cap_;
+ static void CALLBACK CrashProcessCallback(ULONG_PTR) { __debugbreak(); }
+
+ static volatile LONG count_;
+ static volatile LONG cap_;
};
LONG volatile ThreadTracker::count_ = 1;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698