diff options
| author | Samuel Williams <samuel.williams@shopify.com> | 2025-12-08 00:55:13 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-08 00:55:13 +1300 |
| commit | eafaff9443daebba1f4e1a5b2a217b993f066360 (patch) | |
| tree | c007513e1acd3ec499efd104a7e609d3f9e7876b /test/fiber | |
| parent | 941e70ab38d01d067b7bbbcdf8553893a9ca8b49 (diff) | |
Re-introduce support for `io_close` hook. (#15434)
Diffstat (limited to 'test/fiber')
| -rw-r--r-- | test/fiber/scheduler.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/fiber/scheduler.rb b/test/fiber/scheduler.rb index 60261d69e2..029c5043dc 100644 --- a/test/fiber/scheduler.rb +++ b/test/fiber/scheduler.rb @@ -255,6 +255,13 @@ class Scheduler end.value end + # This hook is invoked by `IO#close`. Using a separate IO object + # demonstrates that the close operation is asynchronous. + def io_close(descriptor) + Fiber.blocking{IO.for_fd(descriptor.to_i).close} + return true + end + # This hook is invoked by `Kernel#sleep` and `Thread::Mutex#sleep`. def kernel_sleep(duration = nil) # $stderr.puts [__method__, duration, Fiber.current].inspect |
