8072439: fix for 8047720 may need more work

Cleanup PeriodTask_lock usage. Also reviewed by varming@gmail.com.

Co-authored-by: Carsten Varming <varming@gmail.com>
Reviewed-by: dholmes, dcubed, mgronlun, coleenp
This commit is contained in:
Daniel D. Daugherty 2015-03-02 16:31:25 -08:00
parent 6465239986
commit 12cd46edc9
5 changed files with 59 additions and 40 deletions

View file

@ -1,5 +1,5 @@
/*
* 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
@ -421,9 +421,11 @@ void before_exit(JavaThread * thread) {
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 likelihood of races.
if (PeriodicTask::num_tasks() > 0) {
WatcherThread::stop();
}
// Print statistics gathered (profiling ...)
if (Arguments::has_profile()) {