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);
26  ~MythSignalingTimer() override;
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
MThread::start
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:292
mythbaseexp.h
MythSignalingTimer::isActive
bool isActive(void) const
Definition: mythsignalingtimer.h:33
MythSignalingTimer::timeout
void timeout(void)
MBASE_PUBLIC
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
MThread::run
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:316
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
mthread.h
MythSignalingTimer::m_startStopLock
QMutex m_startStopLock
Definition: mythsignalingtimer.h:42
MythSignalingTimer
Definition: mythsignalingtimer.h:21
MythSignalingTimer::m_timerWait
QWaitCondition m_timerWait
Definition: mythsignalingtimer.h:43
MythSignalingTimer::blockSignals
virtual bool blockSignals(bool block)
Definition: mythsignalingtimer.h:31