GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
ZeroMQ::Poller(3) User Contributed Perl Documentation ZeroMQ::Poller(3)
 

ZeroMQ::Poller - Convenient socket polling object

  use ZeroMQ qw/:all/;
  my $cxt = ZeroMQ::Context->new()
  my $sock = ZeroMQ::Socket->new($cxt, ZMQ_REP);
  $sock->bind("inproc://amazingsocket");
  my $poller = ZeroMQ::Poller->new(
    {
      name      => 'amazing',
      socket    => $sock,
      events    => ZMQ_POLLIN,
      callback  => sub { do_something_amazing },
    },
  );
  $poller->poll();
  do_another_amazing_thing() if $poller->has_event(0);
  do_a_third_amazing_thing() if $poller->has_event('amazing');

A "ZeroMQ::Poller" watches zero or more sockets for events and signals that these have occurred in several ways. Given a list of sockets and events to watch for, it can directly invoke a callback or simply raise a flag.

Creates a new "ZeroMQ::Poller"
The constructor accepts a list of hash references ("poll items"), each of which specifies a socket or file descriptor to watch and what to watch it for. In addition, each poll item may specify a callback to invoke or a name by which it may be queried. The accepted keys are:
socket
Contains the "ZeroMQ::Socket" item to poll.
fd
Contains the file descriptor to poll. One of "socket" or "fd" is required; "socket" has precedence.
events
Some combination of "ZMQ_POLLIN", "ZMQ_POLLOUT", and "ZMQ_POLLERR"; the events to trap.
callback
A coderef taking no arguments and emitting no return value, invoked when the specified events occur on the socket or file descriptor. Optional.
name
A string, naming the poll item for later use with "has_event".

Blocks until there is activity or the given timeout is reached. If no timeout or a negative timeout is specified, blocks indefinitely. If a timeout is given, it is interpreted as microseconds.

Returns true if the poll item at the given index or with the given name reported activity during the last call to "poll".
2011-12-15 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.