Skip to content

Commit

Permalink
Set group only if we don't do add logic
Browse files Browse the repository at this point in the history
Setting the new group before the add logic causes breaks the
removal from the thread's old group. Instead, only directly set
the thread's group if we won't run the add logic.
  • Loading branch information
headius committed Nov 7, 2024
1 parent 49f5697 commit a2511e3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core/src/main/java/org/jruby/RubyThreadGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,11 @@ public IRubyObject add(ThreadContext context, IRubyObject rubyThread, Block bloc
}
}

// always set group when added explicitly
thread.setThreadGroup(this);

// we only add live threads
if (thread.alive_p(context).isTrue()) {
addDirectly(thread);
} else {
thread.setThreadGroup(this);
}

return this;
Expand Down

0 comments on commit a2511e3

Please sign in to comment.