732 private: |
732 private: |
733 static WatcherThread* _watcher_thread; |
733 static WatcherThread* _watcher_thread; |
734 |
734 |
735 static bool _startable; |
735 static bool _startable; |
736 volatile static bool _should_terminate; // updated without holding lock |
736 volatile static bool _should_terminate; // updated without holding lock |
737 |
|
738 os::WatcherThreadCrashProtection* _crash_protection; |
|
739 public: |
737 public: |
740 enum SomeConstants { |
738 enum SomeConstants { |
741 delay_interval = 10 // interrupt delay in milliseconds |
739 delay_interval = 10 // interrupt delay in milliseconds |
742 }; |
740 }; |
743 |
741 |
760 static void start(); |
758 static void start(); |
761 static void stop(); |
759 static void stop(); |
762 // Only allow start once the VM is sufficiently initialized |
760 // Only allow start once the VM is sufficiently initialized |
763 // Otherwise the first task to enroll will trigger the start |
761 // Otherwise the first task to enroll will trigger the start |
764 static void make_startable(); |
762 static void make_startable(); |
765 |
|
766 void set_crash_protection(os::WatcherThreadCrashProtection* crash_protection) { |
|
767 assert(Thread::current()->is_Watcher_thread(), "Can only be set by WatcherThread"); |
|
768 _crash_protection = crash_protection; |
|
769 } |
|
770 |
|
771 bool has_crash_protection() const { return _crash_protection != NULL; } |
|
772 os::WatcherThreadCrashProtection* crash_protection() const { return _crash_protection; } |
|
773 |
|
774 private: |
763 private: |
775 int sleep() const; |
764 int sleep() const; |
776 }; |
765 }; |
777 |
766 |
778 |
767 |