Skip to content

Commit

Permalink
[GR-57835] Remove dead threads from PolyglotContextImpl#threads durin…
Browse files Browse the repository at this point in the history
…g new thread initialization.

PullRequest: graal/18734
  • Loading branch information
jchalou committed Sep 5, 2024
2 parents b2b58af + 4943435 commit 259433a
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,14 @@ Object[] enterThreadChanged(boolean enterReverted, boolean pollSafepoint, boolea
*/
setCachedThreadInfo(PolyglotThreadInfo.NULL);
}
if (needsInitialization) {
/*
* A thread is added to the threads map only by the thread itself, so when
* the thread is in the map, and it is not alive, then it surely won't be
* used ever again.
*/
threads.entrySet().removeIf(threadInfoEntry -> !threadInfoEntry.getKey().isAlive());
}
boolean transitionToMultiThreading = isSingleThreaded() && hasActiveOtherThread(true, false);

if (transitionToMultiThreading) {
Expand Down

0 comments on commit 259433a

Please sign in to comment.