]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/poll.h
Use pimpl in Poller
[libs/core.git] / source / io / poll.h
index 595237474c706acd35d9fdc48aa186d65225b7de..f59b499ddbc3bad3702c42a56507c32969ddac84 100644 (file)
@@ -1,14 +1,10 @@
 #ifndef MSP_IO_POLL_H_
 #define MSP_IO_POLL_H_
 
-#ifndef WIN32
-#include <poll.h>
-#endif
 #include <list>
 #include <map>
 #include <vector>
 #include <msp/time/timedelta.h>
-#include "types.h"
 
 namespace Msp {
 namespace IO {
@@ -45,21 +41,16 @@ public:
                Slot(Base *o, PollEvent e): object(o), events(e) { }
        };
 
-       typedef std::list<Slot> SlotSeq;
+       typedef std::list<Slot> SlotList;
 private:
-       typedef std::map<Base *, Slot> SlotMap;
+       typedef std::map<Base *, PollEvent> EventMap;
 
-#ifdef WIN32
-       struct pollfd
-       {
-               Handle fd;
-       };
-#endif
+       struct Private;
 
-       SlotMap objects;
-       std::vector<pollfd> pfd;
-       bool pfd_dirty;
-       SlotSeq poll_result;
+       EventMap objects;
+       Private *priv;
+       bool objs_changed;
+       SlotList poll_result;
 
 public:
        Poller();
@@ -68,10 +59,10 @@ public:
        int poll();
        int poll(const Time::TimeDelta &);
 private:
-       void rebuild_pfd();
+       void rebuild_array();
        int do_poll(int);
 public:
-       const SlotSeq &get_result() const { return poll_result; }
+       const SlotList &get_result() const { return poll_result; }
 };
 
 PollEvent poll(Base &, PollEvent);