HTTP::Daemon::Threaded::IOSelector

SUMMARY: CONSTR | METHOD | DETAIL: CONSTR | METHOD

## Class HTTP::Daemon::Threaded::IOSelector

Provides a configurable I/O selector that permits distinguishing between read, write, and exception selectors. Used within the HTTP::Daemon::Threaded::Socket object to simplify the process of managing events on I/O handles.

Copyright© 2006, Dean Arnold, Presicient Corp., USA
All rights reserved.

Licensed under the Academic Free License version 2.1, as specified in the License.txt file included in this software package, or at OpenSource.org.

Author:
  D. Arnold
Version:
  0.90
Since:
  2005-12-01

Unless otherwise noted, `$_[0]` is the object instance variable.

Constructor Summary
`new()` Creates separate read, write, and exception IO::Select objects

Method Summary
`addAll($fd)` Add a HTTP::Daemon::Threaded::Socket object to the all selectors
`addExcept($fd)` Add a HTTP::Daemon::Threaded::Socket object to the exception selector
`addNoWrite($fd)` Add a HTTP::Daemon::Threaded::Socket object to the read and exception selector
`addRead($fd)` Add a HTTP::Daemon::Threaded::Socket object to the read selector
`addWrite($fd)` Add a HTTP::Daemon::Threaded::Socket object to the write selector
`getAll()` Return all selectors
`getExcept()` Return the exception selector
`getRead()` Return the read selector
`getTimeout()` Return the current select() timeout value
`getWrite()` Return the write selector
`removeAll($fd)` Remove a HTTP::Daemon::Threaded::Socket object from all the selectors
`removeExcept($fd)` Remove a HTTP::Daemon::Threaded::Socket object from the exception selector
`removeNoWrite($fd)` Remove a HTTP::Daemon::Threaded::Socket object from the read and exception selectors
`removeRead($fd)` Remove a HTTP::Daemon::Threaded::Socket object from the read selector
`removeWrite($fd)` Remove a HTTP::Daemon::Threaded::Socket object from the write selector
`select()` Wait up to the configured timeout for an event on any of the HTTP::Daemon::Threaded::Socket objects installed in any of the read, write, or exception IO::Select objects
`setTimeout($timeout)` Set the select() timeout

Constructor Details

### new

    new()

  Creates separate read, write, and exception IO::Select objects.

  Returns:
    HTTP::Daemon::Threaded::IOSelector object

Method Details

### addAll

    addAll($fd)

  Add a HTTP::Daemon::Threaded::Socket object to the all selectors.

  Parameters:
    `$fd` - a HTTP::Daemon::Threaded::Socket
  Returns:
    HTTP::Daemon::Threaded::IOSelector object

### addExcept

    addExcept($fd)

  Add a HTTP::Daemon::Threaded::Socket object to the exception selector.

  Parameters:
    `$fd` - a HTTP::Daemon::Threaded::Socket
  Returns:
    HTTP::Daemon::Threaded::IOSelector object

### addNoWrite

    addNoWrite($fd)

  Add a HTTP::Daemon::Threaded::Socket object to the read and exception selector.

  Parameters:
    `$fd` - a HTTP::Daemon::Threaded::Socket
  Returns:
    HTTP::Daemon::Threaded::IOSelector object

### addRead

    addRead($fd)

  Add a HTTP::Daemon::Threaded::Socket object to the read selector.

  Parameters:
    `$fd` - a HTTP::Daemon::Threaded::Socket
  Returns:
    HTTP::Daemon::Threaded::IOSelector object

### addWrite

    addWrite($fd)

  Add a HTTP::Daemon::Threaded::Socket object to the write selector.

  Parameters:
    `$fd` - a HTTP::Daemon::Threaded::Socket
  Returns:
    HTTP::Daemon::Threaded::IOSelector object

### getAll

    getAll()

  Return all selectors.

  Returns:
    (read, write, exception IO::Select objects )

### getExcept

    getExcept()

  Return the exception selector.

  Returns:
    IO::Select object

### getRead

    getRead()

  Return the read selector.

  Returns:
    IO::Select object

### getTimeout

    getTimeout()

  Return the current select() timeout value

  Returns:
    timeout value

### getWrite

    getWrite()

  Return the write selector.

  Returns:
    IO::Select object

### removeAll

    removeAll($fd)

  Remove a HTTP::Daemon::Threaded::Socket object from all the selectors.

  Parameters:
    `$fd` - a HTTP::Daemon::Threaded::Socket
  Returns:
    HTTP::Daemon::Threaded::IOSelector object

### removeExcept

    removeExcept($fd)

  Remove a HTTP::Daemon::Threaded::Socket object from the exception selector.

  Parameters:
    `$fd` - a HTTP::Daemon::Threaded::Socket
  Returns:
    HTTP::Daemon::Threaded::IOSelector object

### removeNoWrite

    removeNoWrite($fd)

  Remove a HTTP::Daemon::Threaded::Socket object from the read and exception selectors.

  Parameters:
    `$fd` - a HTTP::Daemon::Threaded::Socket
  Returns:
    HTTP::Daemon::Threaded::IOSelector object

### removeRead

    removeRead($fd)

  Remove a HTTP::Daemon::Threaded::Socket object from the read selector.

  Parameters:
    `$fd` - a HTTP::Daemon::Threaded::Socket
  Returns:
    HTTP::Daemon::Threaded::IOSelector object

### removeWrite

    removeWrite($fd)

  Remove a HTTP::Daemon::Threaded::Socket object from the write selector.

  Parameters:
    `$fd` - a HTTP::Daemon::Threaded::Socket
  Returns:
    HTTP::Daemon::Threaded::IOSelector object

### select

    select()

  Wait up to the configured timeout for an event on any of the HTTP::Daemon::Threaded::Socket objects installed in any of the read, write, or exception IO::Select objects. When events are detected, the handleSocketEvent() method on the HTTP::Daemon::Threaded::Socket object is called, with a bit mask indicating which of the events was detected.

  Returns:
    elapsed time in the function, in seconds

### setTimeout

    setTimeout($timeout)

  Set the select() timeout

  Parameters:
    `$timeout` - number of seconds to select()
  Returns:
    HTTP::Daemon::Threaded::IOSelector object

Generated by psichedoc on Mon Aug 28 09:45:39 2006