luaposix 33.3.0 Reference

# Module `posix.poll`

Synchronous I/O Multiplexing.

Examine file descriptors for events, such as readyness for I/O.

## Functions

poll (fds[, timeout=-1]) | Wait for events on multiple file descriptors.
rpoll (fd[, timeout=-1]) | Wait for some event on a file descriptor.

## Functions

poll (fds[, timeout=-1])
  Wait for events on multiple file descriptors.

  ### Parameters:

  - fds table list of file descriptors
  - timeout int maximum timeout in milliseconds, or -1 to block indefinitely (default -1)

  ### Returns:

  int 0 if timed out, 1 if fd is ready

  ### Or

  1. nil
  2. string error message
  3. int errnum

  ### See also:

  - poll(2)
  - rpoll
  - poll.lua
rpoll (fd[, timeout=-1])
  Wait for some event on a file descriptor. Based on http://lua-users.org/lists/lua-l/2007-11/msg00346.html.

  ### Parameters:

  - fd int file descriptor
  - timeout int maximum timeout in milliseconds, or -1 to block indefinitely (default -1)

  ### Returns:

  int 0 if timed out, 1 if fd is ready

  ### Or

  1. nil
  2. error message
  3. int errnum

  ### See also:

  ### Usage:

      fh = io.open "one"
      while true do
        r = rpoll (fh, 500)
        if r == 0 then
          print 'timeout'
        elseif r == 1 then
          print (fh:read ())
        else
          print "finish!"
          break
        end
      end

generated by LDoc 1.4.3 Last updated 2015-03-01 09:06:02