Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conductors Adjustment #2284

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions jvm/core/src/main/scala/org/scalatest/concurrent/Conductors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1048,10 +1048,17 @@ trait Conductors extends PatienceConfiguration {
// TIMED_WAITING. (BLOCKED is waiting for a lock. WAITING is in the wait set.)
while (threadGroup.areAnyThreadsAlive) {
if (!firstExceptionThrown.isEmpty) {
// If any exception has been thrown, stop any live test thread.
// If any exception has been thrown, stop or interrupt any live test thread.
threadGroup.getThreads.foreach { t =>
if (t.isAlive)
t.stop()
if (t.isAlive) {
try{
t.stop()
}
catch {
case _: UnsupportedOperationException => t.interrupt()
}

}
}
}
// If any threads are in the RUNNABLE state, just check to see if there's been
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ class ConductorSuite extends AnyFunSuite with Matchers with Conductors with Seve
case t: ThreadDeath =>
threadWasKilled.set(true)
throw t
case t: InterruptedException =>
threadWasKilled.set(true)
throw t
}
}
thread {
Expand Down