mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8372769: Test runtime/handshake/HandshakeDirectTest.java failed - JVMTI ERROR 13
Reviewed-by: lmesnik, pchilanomate, cjplummer, amenkov
This commit is contained in:
parent
9b386014a0
commit
1294d55b19
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, 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
|
||||
@ -48,7 +48,7 @@ public class HandshakeDirectTest implements Runnable {
|
||||
static Object[] locks = new Object[WORKING_THREADS];
|
||||
static AtomicInteger handshakeCount = new AtomicInteger(0);
|
||||
|
||||
static void suspendThread(Thread t) {
|
||||
static boolean suspendThread(Thread t) {
|
||||
try {
|
||||
JVMTIUtils.suspendThread(t);
|
||||
} catch (JVMTIUtils.JvmtiException e) {
|
||||
@ -56,7 +56,9 @@ public class HandshakeDirectTest implements Runnable {
|
||||
&& e.getCode() != JVMTIUtils.JVMTI_ERROR_WRONG_PHASE) {
|
||||
throw e;
|
||||
}
|
||||
return false; // failed to suspend
|
||||
}
|
||||
return true; // suspended
|
||||
}
|
||||
|
||||
static void resumeThread(Thread t) {
|
||||
@ -115,7 +117,10 @@ public class HandshakeDirectTest implements Runnable {
|
||||
public void run() {
|
||||
while (true) {
|
||||
int i = ThreadLocalRandom.current().nextInt(0, WORKING_THREADS - 1);
|
||||
suspendThread(workingThreads[i]);
|
||||
boolean suspended = suspendThread(workingThreads[i]);
|
||||
if (!suspended) {
|
||||
continue; // skip resumeThread call if thread was not suspended
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1); // sleep for 1 ms
|
||||
} catch(InterruptedException ie) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user