Tamer file descriptor support
#include <tamer/fd.hh> using namespace tamer;
class fd { public: fd(); ... }
The tamer::fd class wraps file descriptors in a convenient interface for tamer(3) event-based programming. Its methods resemble Unix system calls, but adapted for Tamer events.
fd wrappers are reference-counted and may be freely passed as arguments, copied, assigned, and destroyed. Many fd wrappers may refer to the same underlying file descriptor. This file descriptor is closed when the last wrapper to reference it is destroyed. Alternately, the fd::close() member function explicitly closes the underlying file descriptor. () When an fd file descriptor wrapper is closed, any pending tamer::at_fd_read() and tamer::at_fd_write() events are triggered, and any pending tamer::fd::read(), tamer::fd::write(), tamer::fd::accept(), tamer::fd::connect(), and similar pending fd methods will terminate, with the -ECANCELED error code (or, equivalently, tamer::outcome::cancel). Any fd methods on a closed file descriptor return the -EBADF error code.
For more information, please see the comments in the <tamer/fd.hh> header file, or this Web address:
http://www.read.cs.ucla.edu/tamer/doxygen/classtamer_1_1fd.htmlAUTHOR
Eddie Kohler <kohler@cs.ucla.edu>
Based on joint work on Tame with Maxwell Krohn <krohn@mit.edu> and Frans Kaashoek <kaashoek@mit.edu>SEE ALSO
Events Can Make Sense. Maxwell Krohn, Eddie Kohler, and Frans Kaashoek. In Proc. USENIX 2007 Annual Technical Conference. Also available at http://www.cs.ucla.edu/~kohler/pubs/krohn07events.pdf