mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8180599: Possibly miss to iterate monitors on thread exit
Move thread-local monitors to global lists before thread is removed from global threads list, to ensure all monitors get scanned Reviewed-by: dholmes, rehn
This commit is contained in:
parent
4e05c8c099
commit
8bda8fc602
2 changed files with 13 additions and 10 deletions
|
@ -336,9 +336,6 @@ void Thread::record_stack_base_and_size() {
|
|||
|
||||
|
||||
Thread::~Thread() {
|
||||
// Reclaim the objectmonitors from the omFreeList of the moribund thread.
|
||||
ObjectSynchronizer::omFlush(this);
|
||||
|
||||
EVENT_THREAD_DESTRUCT(this);
|
||||
|
||||
// stack_base can be NULL if the thread is never started or exited before
|
||||
|
@ -4251,6 +4248,10 @@ void Threads::add(JavaThread* p, bool force_daemon) {
|
|||
}
|
||||
|
||||
void Threads::remove(JavaThread* p) {
|
||||
|
||||
// Reclaim the objectmonitors from the omInUseList and omFreeList of the moribund thread.
|
||||
ObjectSynchronizer::omFlush(p);
|
||||
|
||||
// Extra scope needed for Thread_lock, so we can check
|
||||
// that we do not remove thread without safepoint code notice
|
||||
{ MutexLocker ml(Threads_lock);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue