2 #include "eventobject.h"
4 #include "poll_platform.h"
21 void Poller::set_object(EventObject &obj, PollEvent ev)
23 // Verify that the object has an event handle
25 obj.get_event_handle();
27 EventMap::iterator i = objects.find(&obj);
40 if(objects.size()>=MAXIMUM_WAIT_OBJECTS)
41 throw logic_error("Maximum number of wait objects reached");
43 objects.insert(EventMap::value_type(&obj, ev));
54 int Poller::poll(const Time::TimeDelta &timeout)
56 if(timeout<Time::zero)
57 throw invalid_argument("Poller::poll");
59 return do_poll(static_cast<int>(timeout/Time::msec));
62 int Poller::do_poll(int timeout)
69 platform_poll(timeout);
71 return poll_result.size();
76 PollEvent platform_poll(EventObject &, PollEvent, int);
78 PollEvent poll(EventObject &obj, PollEvent pe)
80 return platform_poll(obj, pe, -1);
83 PollEvent poll(EventObject &obj, PollEvent pe, const Time::TimeDelta &timeout)
85 if(timeout<Time::zero)
86 throw invalid_argument("poll");
88 return platform_poll(obj, pe, static_cast<int>(timeout/Time::msec));