comparison src/share/vm/runtime/thread.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 e619a2766bcc
children 6b0fd0964b87 9758d9f36299 94c202aa2646
comparison
equal deleted inserted replaced
11150:c29568b733d2 11151:5e3b6f79d280
731 private: 731 private:
732 static WatcherThread* _watcher_thread; 732 static WatcherThread* _watcher_thread;
733 733
734 static bool _startable; 734 static bool _startable;
735 volatile static bool _should_terminate; // updated without holding lock 735 volatile static bool _should_terminate; // updated without holding lock
736
737 os::WatcherThreadCrashProtection* _crash_protection;
736 public: 738 public:
737 enum SomeConstants { 739 enum SomeConstants {
738 delay_interval = 10 // interrupt delay in milliseconds 740 delay_interval = 10 // interrupt delay in milliseconds
739 }; 741 };
740 742
757 static void start(); 759 static void start();
758 static void stop(); 760 static void stop();
759 // Only allow start once the VM is sufficiently initialized 761 // Only allow start once the VM is sufficiently initialized
760 // Otherwise the first task to enroll will trigger the start 762 // Otherwise the first task to enroll will trigger the start
761 static void make_startable(); 763 static void make_startable();
764
765 void set_crash_protection(os::WatcherThreadCrashProtection* crash_protection) {
766 assert(Thread::current()->is_Watcher_thread(), "Can only be set by WatcherThread");
767 _crash_protection = crash_protection;
768 }
769
770 bool has_crash_protection() const { return _crash_protection != NULL; }
771 os::WatcherThreadCrashProtection* crash_protection() const { return _crash_protection; }
762 772
763 private: 773 private:
764 int sleep() const; 774 int sleep() const;
765 }; 775 };
766 776