Class: WaitPidTimeout
- Inherits:
-
Object
- Object
- WaitPidTimeout
- Defined in:
- lib/rnote/edit.rb
Instance Method Summary collapse
-
#initialize(pid, timeout) ⇒ WaitPidTimeout
constructor
wait in ruby doesn’t take a timeout parameter so, join with timeout => wait with timeout launch a thread that does a wait on the pid.
- #wait ⇒ Object
Constructor Details
#initialize(pid, timeout) ⇒ WaitPidTimeout
wait in ruby doesn’t take a timeout parameter so, join with timeout => wait with timeout launch a thread that does a wait on the pid. then its just a matter of joining that thread, with a timeout.
13 14 15 16 |
# File 'lib/rnote/edit.rb', line 13 def initialize(pid,timeout) @pid = pid @timeout = timeout end |
Instance Method Details
#wait ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/rnote/edit.rb', line 18 def wait @thread ||= Thread.new(@pid) do |pid| Process.waitpid(pid) end !!@thread.join(@timeout) end |