< prev index next >

src/share/vm/runtime/thread.cpp

Print this page
rev 13203 : [mq]: 8183925


1182   set_native_thread_name(name());
1183 }
1184 
1185 void NamedThread::print_on(outputStream* st) const {
1186   st->print("\"%s\" ", name());
1187   Thread::print_on(st);
1188   st->cr();
1189 }
1190 
1191 
1192 // ======= WatcherThread ========
1193 
1194 // The watcher thread exists to simulate timer interrupts.  It should
1195 // be replaced by an abstraction over whatever native support for
1196 // timer interrupts exists on the platform.
1197 
1198 WatcherThread* WatcherThread::_watcher_thread   = NULL;
1199 bool WatcherThread::_startable = false;
1200 volatile bool  WatcherThread::_should_terminate = false;
1201 
1202 WatcherThread::WatcherThread() : Thread(), _crash_protection(NULL) {
1203   assert(watcher_thread() == NULL, "we can only allocate one WatcherThread");
1204   if (os::create_thread(this, os::watcher_thread)) {
1205     _watcher_thread = this;
1206 
1207     // Set the watcher thread to the highest OS priority which should not be
1208     // used, unless a Java thread with priority java.lang.Thread.MAX_PRIORITY
1209     // is created. The only normal thread using this priority is the reference
1210     // handler thread, which runs for very short intervals only.
1211     // If the VMThread's priority is not lower than the WatcherThread profiling
1212     // will be inaccurate.
1213     os::set_priority(this, MaxPriority);
1214     if (!DisableStartThread) {
1215       os::start_thread(this);
1216     }
1217   }
1218 }
1219 
1220 int WatcherThread::sleep() const {
1221   // The WatcherThread does not participate in the safepoint protocol
1222   // for the PeriodicTask_lock because it is not a JavaThread.




1182   set_native_thread_name(name());
1183 }
1184 
1185 void NamedThread::print_on(outputStream* st) const {
1186   st->print("\"%s\" ", name());
1187   Thread::print_on(st);
1188   st->cr();
1189 }
1190 
1191 
1192 // ======= WatcherThread ========
1193 
1194 // The watcher thread exists to simulate timer interrupts.  It should
1195 // be replaced by an abstraction over whatever native support for
1196 // timer interrupts exists on the platform.
1197 
1198 WatcherThread* WatcherThread::_watcher_thread   = NULL;
1199 bool WatcherThread::_startable = false;
1200 volatile bool  WatcherThread::_should_terminate = false;
1201 
1202 WatcherThread::WatcherThread() : Thread() {
1203   assert(watcher_thread() == NULL, "we can only allocate one WatcherThread");
1204   if (os::create_thread(this, os::watcher_thread)) {
1205     _watcher_thread = this;
1206 
1207     // Set the watcher thread to the highest OS priority which should not be
1208     // used, unless a Java thread with priority java.lang.Thread.MAX_PRIORITY
1209     // is created. The only normal thread using this priority is the reference
1210     // handler thread, which runs for very short intervals only.
1211     // If the VMThread's priority is not lower than the WatcherThread profiling
1212     // will be inaccurate.
1213     os::set_priority(this, MaxPriority);
1214     if (!DisableStartThread) {
1215       os::start_thread(this);
1216     }
1217   }
1218 }
1219 
1220 int WatcherThread::sleep() const {
1221   // The WatcherThread does not participate in the safepoint protocol
1222   // for the PeriodicTask_lock because it is not a JavaThread.


< prev index next >