mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
Allow wakeup mutex to be used in trap context. (#13684)
This commit is contained in:
parent
e036d4da8d
commit
ba68343d3a
1
thread.c
1
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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user