Add VM_ASSERT on fiber->blocking == 0. (#7926)

I have not seen any problems with this code, but this ensures the invariant.
This commit is contained in:
Samuel Williams 2023-06-10 23:13:01 +09:00 committed by GitHub
parent a41e088604
commit be86767eef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2023-06-10 14:13:21 +00:00
Merged-By: ioquatix <samuel@codeotaku.com>

2
cont.c
View File

@ -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;