< prev index next >

src/os/posix/vm/os_posix.hpp

Print this page

        

@@ -60,25 +60,32 @@
   static void print_siginfo_brief(outputStream* os, const siginfo_t* si);
 
 };
 
 /*
- * Crash protection for the watcher thread. Wrap the callback
+ * Crash protection utility used by JFR. Wrap the callback
  * with a sigsetjmp and in case of a SIGSEGV/SIGBUS we siglongjmp
  * back.
  * 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 {
+class ThreadCrashProtection : public StackObj {
 public:
-  WatcherThreadCrashProtection();
+  static bool is_crash_protected(Thread* thr) {
+    return _crash_protection != NULL && _protected_thread == thr;
+  }
+
+  ThreadCrashProtection();
   bool call(os::CrashProtectionCallback& cb);
 
   static void check_crash_protection(int signal, Thread* thread);
 private:
+  static Thread* _protected_thread;
+  static ThreadCrashProtection* _crash_protection;
+  static volatile intptr_t _crash_mux;
   void restore();
   sigjmp_buf _jmpbuf;
 };
 
 #endif // OS_POSIX_VM_OS_POSIX_HPP
< prev index next >