comparison base/Thread.h @ 0:fc9323a41f5a

start base : Sonic Visualiser sv1-1.0rc1
author lbajardsilogic
date Fri, 11 May 2007 09:08:14 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:fc9323a41f5a
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 _THREAD_H_
17 #define _THREAD_H_
18
19 #include <QThread>
20 #include <QMutexLocker>
21
22 class Thread : public QThread
23 {
24 Q_OBJECT
25
26 public:
27 enum Type { RTThread, NonRTThread };
28
29 Thread(Type type = NonRTThread, QObject *parent = 0);
30
31 public slots:
32 void start();
33
34 private:
35 Type m_type;
36 };
37
38
39 class MutexLocker
40 {
41 public:
42 MutexLocker(QMutex *mutex, const char *name);
43 ~MutexLocker();
44
45 private:
46 class Printer {
47 public:
48 Printer(const char *name);
49 ~Printer();
50
51 private:
52 const char *m_name;
53 };
54
55 Printer m_printer;
56 QMutexLocker m_locker;
57 };
58
59 #endif