From a1ab00031d731d32943dbccdeebb3226c55ea206 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Wed, 3 Jan 2024 09:56:01 -0600 Subject: [PATCH] Fix blocking in SizedQueue#push --- core/src/main/java/org/jruby/ext/thread/SizedQueue.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/jruby/ext/thread/SizedQueue.java b/core/src/main/java/org/jruby/ext/thread/SizedQueue.java index 25798e776b76..eee671c46626 100644 --- a/core/src/main/java/org/jruby/ext/thread/SizedQueue.java +++ b/core/src/main/java/org/jruby/ext/thread/SizedQueue.java @@ -148,7 +148,11 @@ public IRubyObject push(ThreadContext context, final IRubyObject arg0, final IRu boolean should_block = arg1.isTrue(); try { - return context.getThread().executeTaskBlocking(context, arg0, should_block ? blockingPushTask : nonblockingPushTask); + if (should_block) { + return context.getThread().executeTaskBlocking(context, arg0, blockingPushTask); + } + + return context.getThread().executeTask(context, arg0, nonblockingPushTask); } catch (InterruptedException ie) { throw createInterruptedError(context, "push"); }