From be86767eeff745ac4d0255fa5d14da99e32f59bd Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Sat, 10 Jun 2023 23:13:01 +0900 Subject: [PATCH] Add VM_ASSERT on `fiber->blocking == 0`. (#7926) I have not seen any problems with this code, but this ensures the invariant. --- cont.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cont.c b/cont.c index 4d1b9f0b7a1471..9132ef96ebab28 100644 --- a/cont.c +++ b/cont.c @@ -2810,6 +2810,8 @@ fiber_blocking_yield(VALUE fiber_value) rb_fiber_t *fiber = fiber_ptr(fiber_value); rb_thread_t * volatile th = fiber->cont.saved_ec.thread_ptr; + VM_ASSERT(fiber->blocking == 0); + // fiber->blocking is `unsigned int : 1`, so we use it as a boolean: fiber->blocking = 1;