src/share/vm/gc_implementation/shared/suspendibleThreadSet.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/gc_implementation/shared/suspendibleThreadSet.cpp Tue Apr 14 13:12:07 2015
--- new/src/share/vm/gc_implementation/shared/suspendibleThreadSet.cpp Tue Apr 14 13:12:07 2015
*** 1,7 ****
--- 1,7 ----
/*
! * Copyright (c) 2014, 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.
*** 31,57 ****
--- 31,64 ----
uint SuspendibleThreadSet::_nthreads_stopped = 0;
bool SuspendibleThreadSet::_suspend_all = false;
double SuspendibleThreadSet::_suspend_all_start = 0.0;
void SuspendibleThreadSet::join() {
+ assert(!Thread::current()->is_suspendible_thread(),
+ "Thread already joined");
MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
while (_suspend_all) {
ml.wait(Mutex::_no_safepoint_check_flag);
}
_nthreads++;
+ DEBUG_ONLY(Thread::current()->set_suspendible_thread();)
}
void SuspendibleThreadSet::leave() {
+ assert(Thread::current()->is_suspendible_thread(),
+ "Thread not joined");
MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
assert(_nthreads > 0, "Invalid");
+ DEBUG_ONLY(Thread::current()->clear_suspendible_thread());
_nthreads--;
if (_suspend_all) {
ml.notify_all();
}
}
void SuspendibleThreadSet::yield() {
+ assert(Thread::current()->is_suspendible_thread(), "Must have joined");
if (_suspend_all) {
MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
if (_suspend_all) {
_nthreads_stopped++;
if (_nthreads_stopped == _nthreads) {
src/share/vm/gc_implementation/shared/suspendibleThreadSet.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File