mirror of
https://github.com/rubyjs/mini_racer
synced 2023-03-27 23:21:28 -04:00
simplify timeout implementation
Merely closing the pipe is enough to trigger a wakeup from IO#wait_readable, there's no need to make a write(2) syscall nor copy data in/out of the kernel. We'll use the Ruby 2.3+ 'foo&.method' calls in a few places to simplify code, as well.
This commit is contained in:
parent
5266fec597
commit
bdb0977d81
1 changed files with 4 additions and 7 deletions
|
@ -367,7 +367,7 @@ module MiniRacer
|
|||
done = true
|
||||
end
|
||||
|
||||
wp.write("done")
|
||||
wp.close
|
||||
|
||||
# ensure we do not leak a thread in state
|
||||
t.join
|
||||
|
@ -376,12 +376,9 @@ module MiniRacer
|
|||
rval
|
||||
ensure
|
||||
# exceptions need to be handled
|
||||
if t && wp
|
||||
wp.write("done")
|
||||
t.join
|
||||
end
|
||||
wp.close if wp
|
||||
rp.close if rp
|
||||
wp&.close
|
||||
t&.join
|
||||
rp&.close
|
||||
end
|
||||
|
||||
def check_init_options!(isolate:, snapshot:, max_memory:, marshal_stack_depth:, ensure_gc_after_idle:, timeout:)
|
||||
|
|
Loading…
Add table
Reference in a new issue