Class: Green::Hub::EM::SocketWaiter
Defined Under Namespace
Classes: Handler
Instance Attribute Summary
Attributes inherited from SocketWaiter
#socket
Instance Method Summary
collapse
#initialize
Instance Method Details
#make_handler(mode) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/green/hub/em.rb', line 41
def make_handler(mode)
h = ::EM.watch socket, Handler do |c|
c.green = Green.current
end
case mode
when :readable
h.notify_readable = true
when :writable
h.notify_writable = true
end
Green.hub.switch
ensure
h.detach
end
|
#wait_read ⇒ Object
33
34
35
|
# File 'lib/green/hub/em.rb', line 33
def wait_read
make_handler(:readable)
end
|
#wait_write ⇒ Object
37
38
39
|
# File 'lib/green/hub/em.rb', line 37
def wait_write
make_handler(:writable)
end
|