From ba68343d3ad0465ae9cdaf786dd100b9ed0add07 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Tue, 24 Jun 2025 14:55:07 +0900 Subject: [PATCH] Allow wakeup mutex to be used in trap context. (#13684) --- thread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/thread.c b/thread.c index 5575157728..0f1a1d6b8b 100644 --- a/thread.c +++ b/thread.c @@ -2847,6 +2847,7 @@ rb_thread_io_close_interrupt(struct rb_io *io) // This is used to ensure the correct execution context is woken up after the blocking operation is interrupted: io->wakeup_mutex = rb_mutex_new(); + rb_mutex_allow_trap(io->wakeup_mutex, 1); // We need to use a mutex here as entering the fiber scheduler may cause a context switch: VALUE result = rb_mutex_synchronize(io->wakeup_mutex, thread_io_close_notify_all, (VALUE)io);