mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
7127792: Add the ability to change an existing PeriodicTask's execution interval
Enables dynamic enrollment / disenrollment from the PeriodicTasks in WatcherThread. Reviewed-by: dholmes, mgronlun
This commit is contained in:
parent
61a5a58cb1
commit
e1d995ab86
6 changed files with 162 additions and 92 deletions
|
@ -722,6 +722,7 @@ class WatcherThread: public Thread {
|
|||
private:
|
||||
static WatcherThread* _watcher_thread;
|
||||
|
||||
static bool _startable;
|
||||
volatile static bool _should_terminate; // updated without holding lock
|
||||
public:
|
||||
enum SomeConstants {
|
||||
|
@ -738,6 +739,7 @@ class WatcherThread: public Thread {
|
|||
char* name() const { return (char*)"VM Periodic Task Thread"; }
|
||||
void print_on(outputStream* st) const;
|
||||
void print() const { print_on(tty); }
|
||||
void unpark();
|
||||
|
||||
// Returns the single instance of WatcherThread
|
||||
static WatcherThread* watcher_thread() { return _watcher_thread; }
|
||||
|
@ -745,6 +747,12 @@ class WatcherThread: public Thread {
|
|||
// Create and start the single instance of WatcherThread, or stop it on shutdown
|
||||
static void start();
|
||||
static void stop();
|
||||
// Only allow start once the VM is sufficiently initialized
|
||||
// Otherwise the first task to enroll will trigger the start
|
||||
static void make_startable();
|
||||
|
||||
private:
|
||||
int sleep() const;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue