< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page




1489           os::die();
1490         }
1491 
1492         // Wait a second, then recheck for timeout.
1493         os::naked_short_sleep(999);
1494       }
1495     }
1496 
1497     if (_should_terminate) {
1498       // check for termination before posting the next tick
1499       break;
1500     }
1501 
1502     PeriodicTask::real_time_tick(time_waited);
1503   }
1504 
1505   // Signal that it is terminated
1506   {
1507     MutexLockerEx mu(Terminator_lock, Mutex::_no_safepoint_check_flag);
1508     _watcher_thread = NULL;
1509     Terminator_lock->notify();
1510   }
1511 }
1512 
1513 void WatcherThread::start() {
1514   assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");
1515 
1516   if (watcher_thread() == NULL && _startable) {
1517     _should_terminate = false;
1518     // Create the single instance of WatcherThread
1519     new WatcherThread();
1520   }
1521 }
1522 
1523 void WatcherThread::make_startable() {
1524   assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");
1525   _startable = true;
1526 }
1527 
1528 void WatcherThread::stop() {
1529   {




1489           os::die();
1490         }
1491 
1492         // Wait a second, then recheck for timeout.
1493         os::naked_short_sleep(999);
1494       }
1495     }
1496 
1497     if (_should_terminate) {
1498       // check for termination before posting the next tick
1499       break;
1500     }
1501 
1502     PeriodicTask::real_time_tick(time_waited);
1503   }
1504 
1505   // Signal that it is terminated
1506   {
1507     MutexLockerEx mu(Terminator_lock, Mutex::_no_safepoint_check_flag);
1508     _watcher_thread = NULL;
1509     Terminator_lock->notify_all();
1510   }
1511 }
1512 
1513 void WatcherThread::start() {
1514   assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");
1515 
1516   if (watcher_thread() == NULL && _startable) {
1517     _should_terminate = false;
1518     // Create the single instance of WatcherThread
1519     new WatcherThread();
1520   }
1521 }
1522 
1523 void WatcherThread::make_startable() {
1524   assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");
1525   _startable = true;
1526 }
1527 
1528 void WatcherThread::stop() {
1529   {


< prev index next >