Skip to content

Commit

Permalink
Replace assert with RUBY_ASSERT in thread_sync.c
Browse files Browse the repository at this point in the history
assert does not print the bug report, only the file and line number of
the assertion that failed. RUBY_ASSERT prints the full bug report, which
makes it much easier to debug.
  • Loading branch information
peterzhu2118 committed Feb 12, 2024
1 parent 9a2b692 commit 80700f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions thread_sync.c
Expand Up @@ -854,7 +854,7 @@ raise_closed_queue_error(VALUE self)
static VALUE
queue_closed_result(VALUE self, struct rb_queue *q)
{
assert(queue_length(self, q) == 0);
RUBY_ASSERT(queue_length(self, q) == 0);
return Qnil;
}

Expand Down Expand Up @@ -1081,8 +1081,8 @@ queue_do_pop(VALUE self, struct rb_queue *q, int should_block, VALUE timeout)
else {
rb_execution_context_t *ec = GET_EC();

assert(RARRAY_LEN(q->que) == 0);
assert(queue_closed_p(self) == 0);
RUBY_ASSERT(RARRAY_LEN(q->que) == 0);
RUBY_ASSERT(queue_closed_p(self) == 0);

struct queue_waiter queue_waiter = {
.w = {.self = self, .th = ec->thread_ptr, .fiber = nonblocking_fiber(ec->fiber_ptr)},
Expand Down

0 comments on commit 80700f4

Please sign in to comment.