Thread.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7  This file copyright 2006 Chris Cannam.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version. See the file
13  COPYING included with this distribution for more information.
14 */
15 
16 #ifndef SV_THREAD_H
17 #define SV_THREAD_H
18 
19 #include <QThread>
20 #include <QMutexLocker>
21 
22 #include "Profiler.h"
23 
24 class Thread : public QThread
25 {
26 Q_OBJECT
27 
28 public:
30 
31  Thread(Type type = NonRTThread, QObject *parent = 0);
32 
33 public slots:
34  void start();
35 
36 protected:
37  void run() override = 0;
38 
39 private:
41 };
42 
44 {
45 public:
46  MutexLocker(QMutex *mutex, const char *name);
47  ~MutexLocker();
48 
49 private:
50  class Printer {
51  public:
52  Printer(const char *name);
53  ~Printer();
54 
55  private:
56  const char *m_name;
57  };
58 
61  QMutexLocker m_locker;
62 };
63 
64 #endif
Thread(Type type=NonRTThread, QObject *parent=0)
Definition: Thread.cpp:26
void start()
Definition: Thread.cpp:34
static QMutex mutex
Definition: Debug.cpp:30
Printer m_printer
Definition: Thread.h:60
Profiler m_profiler
Definition: Thread.h:59
Type
Definition: Thread.h:29
const char * m_name
Definition: Thread.h:56
Type m_type
Definition: Thread.h:40
void run() override=0
Definition: Thread.h:24
QMutexLocker m_locker
Definition: Thread.h:61
Profile point instance class.
Definition: Profiler.h:93