Skip to content

Commit

Permalink
Add VM_ASSERT on fiber->blocking == 0. (#7926)
Browse files Browse the repository at this point in the history
I have not seen any problems with this code, but this ensures the invariant.
  • Loading branch information
ioquatix committed Jun 10, 2023
1 parent a41e088 commit be86767
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cont.c
Expand Up @@ -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;

Expand Down

0 comments on commit be86767

Please sign in to comment.