# File lib/pr_eventmachine.rb, line 442
442:     def initialize io
443:       @uuid = UuidGenerator.generate
444:       @io = io
445:       @last_activity = Reactor.instance.current_loop_time
446: 
447:       if defined?(Fcntl::F_GETFL)
448:         m = @io.fcntl(Fcntl::F_GETFL, 0)
449:         @io.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK | m)
450:       else
451:               # Windows doesn't define F_GETFL.
452:               # It's not very reliable about setting descriptors nonblocking either.
453:               begin
454:                s = Socket.for_fd(@io.fileno)
455:                s.fcntl( Fcntl::F_SETFL, Fcntl::O_NONBLOCK )
456:               rescue Errno::EINVAL, Errno::EBADF
457:                       STDERR.puts "Serious error: unable to set descriptor non-blocking"
458:               end
459:       end
460:       # TODO, should set CLOEXEC on Unix?
461: 
462:       @close_scheduled = false
463:       @close_requested = false
464: 
465:       se = self; @io.instance_eval { @my_selectable = se }
466:       Reactor.instance.add_selectable @io
467:     end