Method: NIO::Selector#initialize

Defined in:
lib/nio/selector.rb,
ext/nio4r/selector.c
more...

#initialize(backend = :ruby) ⇒ Object

Instance methods

[View source]

31
32
33
34
35
36
37
38
39
40
# File 'lib/nio/selector.rb', line 31

def initialize(backend = :ruby)
  raise ArgumentError, "unsupported backend: #{backend}" unless [:ruby, nil].include?(backend)

  @selectables = {}
  @lock = Mutex.new

  # Other threads can wake up a selector
  @wakeup, @waker = IO.pipe
  @closed = false
end