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

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,14 +21,18 @@
public:
static void NTAPI UpdateCount(PVOID module, DWORD reason, PVOID reserved) {
if (reason == DLL_THREAD_ATTACH) {
- if (::InterlockedIncrement(&count_) > cap_)
- __debugbreak();
+ if (::InterlockedIncrement(&count_) > cap_) {
+ cap_ = LONG_MAX;
+ // We schedule a callback, because the loader would eat an exception.
+ ::QueueUserAPC(CrashProcessCallback, ::GetCurrentThread(), NULL);
+ }
} else if (reason == DLL_THREAD_DETACH) {
::InterlockedDecrement(&count_);
}
}
static void SetCap(LONG cap) { cap_ = cap; }
+ static void CALLBACK CrashProcessCallback(ULONG_PTR) { __debugbreak(); }
cpu_(ooo_6.6-7.5) 2012/09/16 00:19:10 move to private
private:
static LONG volatile count_;
« 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