src/share/vm/runtime/java.cpp
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -420,13 +420,15 @@
// Hang forever on exit if we're reporting an error.
if (ShowMessageBoxOnError && is_error_reported()) {
os::infinite_sleep();
}
- // Terminate watcher thread - must before disenrolling any periodic task
- if (PeriodicTask::num_tasks() > 0)
+ // Stop the WatcherThread. We do this before disenrolling various
+ // PeriodicTasks to reduce the likelyhood of races.
+ if (PeriodicTask::num_tasks() > 0) {
WatcherThread::stop();
+ }
// Print statistics gathered (profiling ...)
if (Arguments::has_profile()) {
FlatProfiler::disengage();
FlatProfiler::print(10);