Skip to content

Commit

Permalink
8310551: vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java …
Browse files Browse the repository at this point in the history
…timed out due to missing prompt

Backport-of: c84866ac0dcda487fe2abc2a8841f237df0a395b
  • Loading branch information
Andrew Lu committed Jan 8, 2024
1 parent ed37e2d commit 9a16bee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2023, 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
Expand Down Expand Up @@ -90,7 +90,7 @@ public static int run(String argv[], PrintStream out) {
static final String LAST_BREAK = DEBUGGEE_CLASS + ".breakHere";
static final String MYTHREAD = "MyThread";
static final String DEBUGGEE_THREAD = DEBUGGEE_CLASS + "$" + MYTHREAD;
static final String DEBUGGEE_RESULT = DEBUGGEE_CLASS + ".notInterrupted.get()";
static final String DEBUGGEE_RESULT = DEBUGGEE_CLASS + ".notInterrupted";

static int numThreads = nsk.jdb.interrupt.interrupt001.interrupt001a.numThreads;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2023, 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
Expand Down Expand Up @@ -56,8 +56,8 @@ public void run() {
lock.wait();
}
} catch (InterruptedException e) {
notInterrupted.decrementAndGet();
synchronized (waitnotify) {
notInterrupted--;
waitnotify.notify();
}
}
Expand All @@ -83,7 +83,7 @@ static void breakHere () {}
private JdbArgumentHandler argumentHandler;
private Log log;

public static final AtomicInteger notInterrupted = new AtomicInteger(numThreads);
public static volatile int notInterrupted = numThreads;

public int runIt(String args[], PrintStream out) {

Expand Down Expand Up @@ -122,8 +122,8 @@ public int runIt(String args[], PrintStream out) {

long waitTime = argumentHandler.getWaitTime() * 60 * 1000;
long startTime = System.currentTimeMillis();
while (notInterrupted.get() > 0 && System.currentTimeMillis() - startTime <= waitTime) {
synchronized (waitnotify) {
synchronized (waitnotify) {
while (notInterrupted > 0 && System.currentTimeMillis() - startTime <= waitTime) {
try {
waitnotify.wait(waitTime);
} catch (InterruptedException e) {
Expand Down

1 comment on commit 9a16bee

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.