MythTV  master
mythsignalingtimer.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #ifndef _MYTH_SIGNALING_TIMER_H_
4 #define _MYTH_SIGNALING_TIMER_H_
5 
6 #include <cstdint>
7 
8 #include <QWaitCondition>
9 #include <QMutex>
10 
11 #include "mythbaseexp.h"
12 #include "mthread.h"
13 
20 class MBASE_PUBLIC MythSignalingTimer : private QObject, private MThread
21 {
22  Q_OBJECT
23 
24  public:
25  MythSignalingTimer(QObject *parent, const char *slot);
27 
28  virtual void stop(void);
29  virtual void start(int msec);
30 
31  virtual bool blockSignals(bool block)
32  { return QObject::blockSignals(block); }
33  bool isActive(void) const
34  { return m_dorun; }
35 
36  signals:
37  void timeout(void);
38 
39  private:
40  void run(void) override; // MThread
41 
43  QWaitCondition m_timerWait;
44  volatile bool m_dorun {false};
45  volatile bool m_running {false};
46  volatile uint64_t m_millisec {0};
47 };
48 
49 #endif // _MYTH_SIGNALING_TIMER_H_
void start(QThread::Priority=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:294
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:46
virtual void run(void)
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: mthread.cpp:318
bool isActive(void) const
virtual bool blockSignals(bool block)
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
QWaitCondition m_timerWait
This class is essentially a workaround for a Qt 4.5.2 bug where it will get stuck in the Qt event loo...