< prev index next >

src/os/posix/vm/os_posix.hpp

Print this page




  72 /*
  73  * Crash protection for the watcher thread. Wrap the callback
  74  * with a sigsetjmp and in case of a SIGSEGV/SIGBUS we siglongjmp
  75  * back.
  76  * To be able to use this - don't take locks, don't rely on destructors,
  77  * don't make OS library calls, don't allocate memory, don't print,
  78  * don't call code that could leave the heap / memory in an inconsistent state,
  79  * or anything else where we are not in control if we suddenly jump out.
  80  */
  81 class WatcherThreadCrashProtection : public StackObj {
  82 public:
  83   WatcherThreadCrashProtection();
  84   bool call(os::CrashProtectionCallback& cb);
  85 
  86   static void check_crash_protection(int signal, Thread* thread);
  87 private:
  88   void restore();
  89   sigjmp_buf _jmpbuf;
  90 };
  91 








  92 #endif // OS_POSIX_VM_OS_POSIX_HPP


  72 /*
  73  * Crash protection for the watcher thread. Wrap the callback
  74  * with a sigsetjmp and in case of a SIGSEGV/SIGBUS we siglongjmp
  75  * back.
  76  * To be able to use this - don't take locks, don't rely on destructors,
  77  * don't make OS library calls, don't allocate memory, don't print,
  78  * don't call code that could leave the heap / memory in an inconsistent state,
  79  * or anything else where we are not in control if we suddenly jump out.
  80  */
  81 class WatcherThreadCrashProtection : public StackObj {
  82 public:
  83   WatcherThreadCrashProtection();
  84   bool call(os::CrashProtectionCallback& cb);
  85 
  86   static void check_crash_protection(int signal, Thread* thread);
  87 private:
  88   void restore();
  89   sigjmp_buf _jmpbuf;
  90 };
  91 
  92 class PosixSemaphore : public Semaphore {
  93  public:
  94   PosixSemaphore(uint value = 0) : Semaphore(value) {}
  95 
  96   bool trywait();
  97   bool timedwait(struct timespec ts);
  98 };
  99 
 100 #endif // OS_POSIX_VM_OS_POSIX_HPP
< prev index next >