Replace assert with RUBY_ASSERT in thread_sync.c

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.
This commit is contained in:
Peter Zhu 2024-02-08 09:45:28 -05:00
Родитель 9a2b692249
Коммит 80700f453e
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -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;
}
@ -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)},