Mercurial > hg > graal-compiler
diff src/os/windows/vm/os_windows.hpp @ 11151:5e3b6f79d280
8020701: Avoid crashes in WatcherThread
Reviewed-by: acorn, dcubed, dsimms
author | rbackman |
---|---|
date | Wed, 17 Jul 2013 13:48:15 +0200 |
parents | 59b052799158 |
children | b0133e4187d3 6c9332549827 |
line wrap: on
line diff
--- a/src/os/windows/vm/os_windows.hpp Thu Jul 18 06:47:15 2013 -0400 +++ b/src/os/windows/vm/os_windows.hpp Wed Jul 17 13:48:15 2013 +0200 @@ -102,6 +102,20 @@ static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e); }; +/* + * Crash protection for the watcher thread. Wrap the callback + * with a __try { call() } + * To be able to use this - don't take locks, don't rely on destructors, + * don't make OS library calls, don't allocate memory, don't print, + * don't call code that could leave the heap / memory in an inconsistent state, + * or anything else where we are not in control if we suddenly jump out. + */ +class WatcherThreadCrashProtection : public StackObj { +public: + WatcherThreadCrashProtection(); + bool call(os::CrashProtectionCallback& cb); +}; + class PlatformEvent : public CHeapObj<mtInternal> { private: double CachePad [4] ; // increase odds that _Event is sole occupant of cache line