From 80700f453e8ca13925790bd980197dc302696c0a Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 8 Feb 2024 09:45:28 -0500 Subject: [PATCH] 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. --- thread_sync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/thread_sync.c b/thread_sync.c index 0792da481d47b1..ae69cb4a6e708e 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -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)},