]> git.tdb.fi Git - libs/core.git/blobdiff - source/time/timer.h
Add move semantics to Variant
[libs/core.git] / source / time / timer.h
index 21aeb2b4b5b02ea0b41932f4a3311028f35c7e55..7cb5c764d59979e0316e2e365444940ad8e4d786 100644 (file)
@@ -3,7 +3,9 @@
 
 #include <vector>
 #include <sigc++/sigc++.h>
+#include <msp/core/mspcore_api.h>
 #include <msp/core/mutex.h>
+#include <msp/core/noncopyable.h>
 #include <msp/core/semaphore.h>
 #include "timedelta.h"
 #include "timestamp.h"
@@ -18,7 +20,7 @@ of the returned slot.
 
 This class is thread-safe, to allow running timers in a separate thread.
 */
-class Timer
+class MSPCORE_API Timer: private NonCopyable
 {
 public:
        class Slot
@@ -42,14 +44,13 @@ private:
        {
                Slot *slot;
 
-               SlotProxy(Slot *);
                bool operator<(const SlotProxy &) const;
        };
 
        std::vector<SlotProxy> slots;
        Semaphore sem;
        Mutex mutex;
-       bool blocking;
+       bool blocking = false;
 
 public:
        Timer();
@@ -66,9 +67,6 @@ public:
        /** Cancels a previously added timer. */
        void cancel(Slot &);
 
-       /** Deprecated.  Use one of the other overloads. */
-       void tick(bool block);
-
        /** Waits until a timer expires, then executes it.  If no timers have been
        set, blocks until one is added from another thread. */
        void tick();