cl-async

Pollers

A poller is an object that watches an operating system file descriptor for you and tells you when it’s ready to be read or written to.

poller

This class wraps a poller, responsible for notifying you of changes to a file descriptor.

It is an opaque object meant to be passed to free-poller.

poller-freed-p
(defmethod poller-freed-p ((poller poller)))
  => t/nil

This method lets us know if a poller has already been freed.

poll

(defun poll (fd poll-cb &key event-cb (poll-for '(:readable :writable)) socket))
  => poller

Starts polling the given fd, calling the poll-cb callback whenever the fd is ready for the actions given in the list :poll-for (allowed actions are :readable and :writable).

You can optionally pass an :event-cb function, called when errors occur while polling.

If you are polling an fd that’s a socket, you must pass :socket t.

free-poller

(defun free-poller (poller))
  => nil

Stops the given poller and frees its resources.