lib/invoker/reactor.rb in invoker-0.0.3 vs lib/invoker/reactor.rb in invoker-0.1.1.pre
- old
+ new
@@ -11,16 +11,10 @@
def remove_from_monitoring(fd)
@monitored_fds.delete(fd)
end
- def start
- loop do
- watch_on_pipe
- end
- end
-
def watch_on_pipe
ready_read_fds,ready_write_fds,read_error_fds = select(monitored_fds,[],[],0.05)
if ready_read_fds && !ready_read_fds.empty?
handle_read_event(ready_read_fds)
@@ -36,9 +30,10 @@
command_worker = Invoker::COMMANDER.get_worker_from_fd(ready_fd)
begin
data = read_data(ready_fd)
command_worker.receive_data(data)
rescue Invoker::Errors::ProcessTerminated
+ remove_from_monitoring(command_worker.pipe_end)
command_worker.unbind()
end
end
def read_data(ready_fd)