Skip to content

Instantly share code, notes, and snippets.

@toretore
Forked from mikecmpbll/act.rb
Last active Aug 29, 2015
Embed
What would you like to do?
w_r, w_w = IO.pipe
t_r, t_w = IO.pipe
work = Thread.new { block.call; w_w.write('.') }
timeout = Thread.new{ sleep 10; t_w.write('.') }
io = IO.select [w_r, t_r]
if io == t_r
#Timeout
else
#No timeout
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment