poll.rb
Path: lib/poll.rb
Modified: Mon Oct 21 03:47:01 GMT 2002

An object-oriented implementation of poll(2) for Ruby

Synopsis

      require 'poll'
      require 'socket'

      pollobj = Poll::new
      sock = TCPServer::new('localhost', 1138)
      pollobj.register( sock, Poll::RDNORM ) {|sock,evmask|
              case evmask
              when Poll::RDNORM
                      clsock = sock.accept
                      pollobj.mask( clsock, Poll::RDNORM, clientHandler )

              when Poll::HUP|Poll::ERR|Poll::NVAL
                      pollobj.remove( io )
                      $stderr.puts "Server error: Shutting down"
              else
                      $stderr.puts "Unhandled event: #{evmask}"
              end
      }

      pollobj.poll( 0.25 ) until poll.handles.empty?

Author

Michael Granger <ged@FaerieMUD.org>

Copyright © 2002 The FaerieMUD Consortium. All rights reserved.

This module is free software. You may use, modify, and/or redistribute this software under the same terms as Ruby itself.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Version

 $Id: poll.rb,v 1.10 2002/10/21 03:47:01 deveiant Exp $
Required files
delegate    poll.so   
Classes and Modules
Class Poll
  ::Class Poll::EventMask