mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 10:04:42 +02:00
8233454: Test fails with assert(!is_init_completed(), "should only happen during init") after JDK-8229516
Reviewed-by: jiefu, dcubed
This commit is contained in:
parent
7b730a361a
commit
4272078d30
2 changed files with 11 additions and 7 deletions
|
@ -1741,6 +1741,16 @@ void JavaThread::interrupt() {
|
|||
|
||||
bool JavaThread::is_interrupted(bool clear_interrupted) {
|
||||
debug_only(check_for_dangling_thread_pointer(this);)
|
||||
|
||||
if (threadObj() == NULL) {
|
||||
// If there is no j.l.Thread then it is impossible to have
|
||||
// been interrupted. We can find NULL during VM initialization
|
||||
// or when a JNI thread is still in the process of attaching.
|
||||
// In such cases this must be the current thread.
|
||||
assert(this == Thread::current(), "invariant");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool interrupted = java_lang_Thread::interrupted(threadObj());
|
||||
|
||||
// NOTE that since there is no "lock" around the interrupt and
|
||||
|
@ -1759,6 +1769,7 @@ bool JavaThread::is_interrupted(bool clear_interrupted) {
|
|||
// state if we are going to report that we were interrupted; otherwise
|
||||
// an interrupt that happens just after we read the field would be lost.
|
||||
if (interrupted && clear_interrupted) {
|
||||
assert(this == Thread::current(), "only the current thread can clear");
|
||||
java_lang_Thread::set_interrupted(threadObj(), false);
|
||||
osthread()->set_interrupted(false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue