summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scheduler.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/scheduler.c b/scheduler.c
index c2f370a22a..3205bb3bc9 100644
--- a/scheduler.c
+++ b/scheduler.c
@@ -1111,6 +1111,9 @@ VALUE rb_fiber_scheduler_blocking_operation_wait(VALUE scheduler, void* (*functi
operation->data2 = NULL;
operation->unblock_function = NULL;
+ // Ensure that the blocking operation remains visible until this point:
+ RB_GC_GUARD(blocking_operation);
+
// If the blocking operation was never executed, return Qundef to signal the caller to use rb_nogvl instead
if (current_status == RB_FIBER_SCHEDULER_BLOCKING_OPERATION_STATUS_QUEUED) {
return Qundef;