00001 00009 #ifndef ATOMS_SELECT_POLLER_HH 00010 #define ATOMS_SELECT_POLLER_HH 00011 00012 #include <atoms/gen.hh> 00013 #include <sys/time.h> 00014 #include <sys/types.h> 00015 #include <unistd.h> 00016 #include <boost/utility.hpp> 00017 #include <boost/shared_ptr.hpp> 00018 #include <atoms/io_poller.hh> 00019 #include <atoms/debug.hh> 00020 00021 namespace atoms { 00022 00029 class SelectPoller : public IOPoller { 00030 public: 00031 ~SelectPoller() {} 00032 void add(int fd, Event eventMask, const EventHandler &onEvent); 00033 void remove(int fd, Event eventMask); 00034 void remove(int fd, bool isClosing = false); 00035 void poll(const Timespan &interval = Timespan::tINFINITY); 00036 bool supportsEdgeTriggering() const { return false; } 00037 00038 static boost::shared_ptr<IOPoller> create() { 00039 return boost::shared_ptr<IOPoller>(new SelectPoller()); 00040 } 00041 00042 private: 00043 SelectPoller(); 00044 00045 fd_set readset, 00046 writeset, 00047 exceptset; 00048 00049 00050 static DebugLogger LOGGER; 00051 }; 00052 00053 } 00054 #endif
1.3.5