ruby-changes:72814
From: Jean <ko1@a...>
Date: Thu, 4 Aug 2022 18:48:56 +0900 (JST)
Subject: [ruby-changes:72814] 6b2fc33ae2 (master): thread_sync.c: pass proper argument to queue_sleep in rb_szqueue_push
https://git.ruby-lang.org/ruby.git/commit/?id=6b2fc33ae2 From 6b2fc33ae231594eb69f93c493e2c314931b0990 Mon Sep 17 00:00:00 2001 From: Jean Boussier <jean.boussier@g...> Date: Thu, 4 Aug 2022 10:37:46 +0200 Subject: thread_sync.c: pass proper argument to queue_sleep in rb_szqueue_push When I removed the SizeQueue#push timeout from my PR, I forgot to update the `queue_sleep` parameters to be a `queue_sleep_arg`. Somehow this worked on most archs, but on Solaris/Sparc it would legitimately crash when trying to access the `timeout` and `end` members of the struct. --- thread_sync.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/thread_sync.c b/thread_sync.c index 1a0f3ee855..0359ac2214 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -1277,7 +1277,13 @@ rb_szqueue_push(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L1277 ccan_list_add_tail(pushq, &queue_waiter.w.node); sq->num_waiting_push++; - rb_ensure(queue_sleep, self, szqueue_sleep_done, (VALUE)&queue_waiter); + struct queue_sleep_arg queue_sleep_arg = { + .self = self, + .timeout = Qnil, + .end = 0 + }; + + rb_ensure(queue_sleep, (VALUE)&queue_sleep_arg, szqueue_sleep_done, (VALUE)&queue_waiter); } } -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/