Prototype two workers: blocking and multiplexing

This commit is contained in:
Thibault Jouan
2015-04-17 21:25:00 +00:00
parent 0164b52465
commit 0176ab0010
5 changed files with 89 additions and 0 deletions

31
lib/uh/wm/workers/base.rb Normal file
View File

@@ -0,0 +1,31 @@
module Uh
module WM
module Workers
class Base
def initialize **options
@ios = []
end
def watch io
@ios << io
end
def before_wait &block
if block_given? then @before_wait = block else @before_wait end
end
def on_timeout &block
if block_given? then @on_timeout = block else @on_timeout end
end
def on_read &block
if block_given? then @on_read = block else @on_read end
end
def on_read_next &block
if block_given? then @on_read_next = block else @on_read_next end
end
end
end
end
end