@@ -1097,11 +1097,31 @@ VALUE rb_fiber_scheduler_blocking_operation_wait(VALUE scheduler, void* (*functi
10971097
10981098 // Create a new BlockingOperation with the blocking operation
10991099 VALUE blocking_operation = rb_fiber_scheduler_blocking_operation_new (function , data , unblock_function , data2 , flags , state );
1100+ // Success, this works:
1101+ rb_fiber_scheduler_blocking_operation_t * operation = get_blocking_operation (blocking_operation );
1102+
1103+ size_t gc_count_before = rb_gc_count ();
1104+ size_t minor_before = rb_gc_stat (ID2SYM (rb_intern ("minor_gc_count" )));
1105+ size_t major_before = rb_gc_stat (ID2SYM (rb_intern ("major_gc_count" )));
1106+ fprintf (stderr , "before rb_funcall: gc_count=%zu minor=%zu major=%zu operation=%p\n" ,
1107+ gc_count_before , minor_before , major_before , operation );
11001108
11011109 VALUE result = rb_funcall (scheduler , id_blocking_operation_wait , 1 , blocking_operation );
11021110
1111+ size_t gc_count_after = rb_gc_count ();
1112+ size_t minor_after = rb_gc_stat (ID2SYM (rb_intern ("minor_gc_count" )));
1113+ size_t major_after = rb_gc_stat (ID2SYM (rb_intern ("major_gc_count" )));
1114+ fprintf (stderr , "after rb_funcall: gc_count=%zu minor=%zu major=%zu (delta: %zu minor, %zu major)\n" ,
1115+ gc_count_after , minor_after , major_after ,
1116+ minor_after - minor_before , major_after - major_before );
1117+
1118+ fprintf (stderr , "blocking_operation_wait: operation=%p, operation->status=%d\n" , operation , operation -> status );
1119+
1120+ // Evidence suggests this fails:
1121+ operation = get_blocking_operation (blocking_operation );
1122+ fprintf (stderr , "get_blocking_operation: operation=%p, operation->status=%d\n" , operation , operation -> status );
1123+
11031124 // Get the operation data to check if it was executed
1104- rb_fiber_scheduler_blocking_operation_t * operation = get_blocking_operation (blocking_operation );
11051125 rb_atomic_t current_status = RUBY_ATOMIC_LOAD (operation -> status );
11061126
11071127 // Invalidate the operation now that we're done with it
0 commit comments