]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/poll.cpp
Add move semantics to Variant
[libs/core.git] / source / io / poll.cpp
index 4ca2f3d9767ea3315d172ba25dd51831afb7f660..7aa41e1c330c9ac41ae5ebdf9fa96eb3678a274c 100644 (file)
@@ -1,4 +1,4 @@
-#include <stdexcept>
+#include <msp/core/except.h>
 #include <msp/core/algorithm.h>
 #include "eventobject.h"
 #include "poll.h"
@@ -10,9 +10,7 @@ namespace Msp {
 namespace IO {
 
 Poller::Poller():
-       priv(new Private),
-       events_changed(false),
-       objs_changed(false)
+       priv(new Private)
 { }
 
 Poller::~Poller()
@@ -46,10 +44,10 @@ void Poller::set_object(EventObject &obj, PollEvent ev)
 
 #ifdef _WIN32
        if(objects.size()>=MAXIMUM_WAIT_OBJECTS)
-               throw logic_error("Maximum number of wait objects reached");
+               throw invalid_state("too many objects");
 #endif
 
-       objects.push_back(PolledObject(&obj, ev));
+       objects.push_back({ &obj, ev });
        objs_changed = true;
 }
 
@@ -93,7 +91,7 @@ PollEvent poll(EventObject &obj, PollEvent pe)
 PollEvent poll(EventObject &obj, PollEvent pe, const Time::TimeDelta &timeout)
 {
        if(timeout<Time::zero)
-               throw invalid_argument("poll");
+               throw invalid_argument("IO::poll");
 
        return platform_poll(obj, pe, static_cast<int>(timeout/Time::msec));
 }