# File lib/puppet/external/event-loop/event-loop.rb, line 64
64:   def initialize
65:     @running = false
66:     @awake = false
67:     @wakeup_time = nil
68:     @timers = []
69: 
70:     @io_arrays = [[], [], []]
71:     @ios = Hash.new do |h, k| raise ArgumentError,
72:       "invalid IO event: #{k}", caller(2) end
73:     IO_STATES.each_with_index { |x, i| @ios[x] = @io_arrays[i] }
74: 
75:     @notify_src, @notify_snk = IO.pipe
76: 
77:     # prevent file descriptor leaks
78:     if @notify_src.respond_to?(:fcntl) and defined?(Fcntl) and defined?(Fcntl::F_SETFD) and defined?(Fcntl::FD_CLOEXEC)
79:       @notify_src.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
80:       @notify_snk.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
81:     end
82: 
83:     @notify_src.will_block = false
84:     @notify_snk.will_block = false
85: 
86:     # Each time a byte is sent through the notification pipe
87:     # we need to read it, or IO.select will keep returning.
88:     monitor_io(@notify_src, :readable)
89:     @notify_src.extend(Watchable)
90:     @notify_src.on_readable do
91:       begin
92:         @notify_src.sysread(256)
93:       rescue Errno::EAGAIN
94:         # The pipe wasn't readable after all.
95:       end
96:     end
97:   end