#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>
This class is thread-safe, to allow running timers in a separate thread.
*/
-class Timer: private NonCopyable
+class MSPCORE_API Timer: private NonCopyable
{
public:
class Slot
{
Slot *slot;
- SlotProxy(Slot *);
bool operator<(const SlotProxy &) const;
};
std::vector<SlotProxy> slots;
Semaphore sem;
Mutex mutex;
- bool blocking;
+ bool blocking = false;
public:
Timer();
/** 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();