svcore
1.9
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 _THREAD_H_
17
#define _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
:
29
enum
Type
{
RTThread
,
NonRTThread
};
30
31
Thread
(
Type
type =
NonRTThread
, QObject *parent = 0);
32
33
public
slots:
34
void
start
();
35
36
protected
:
37
virtual
void
run
() = 0;
38
39
private
:
40
Type
m_type
;
41
};
42
43
class
MutexLocker
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
59
Profiler
m_profiler
;
60
Printer
m_printer
;
61
QMutexLocker
m_locker
;
62
};
63
64
#endif
MutexLocker
Definition:
Thread.h:43
Thread::run
virtual void run()=0
Thread::Thread
Thread(Type type=NonRTThread, QObject *parent=0)
Definition:
Thread.cpp:26
Thread::start
void start()
Definition:
Thread.cpp:34
mutex
static QMutex mutex
Definition:
Debug.cpp:32
MutexLocker::m_printer
Printer m_printer
Definition:
Thread.h:60
MutexLocker::MutexLocker
MutexLocker(QMutex *mutex, const char *name)
Definition:
Thread.cpp:60
MutexLocker::m_profiler
Profiler m_profiler
Definition:
Thread.h:59
MutexLocker::Printer::~Printer
~Printer()
Definition:
Thread.cpp:84
Profiler.h
Thread::Type
Type
Definition:
Thread.h:29
MutexLocker::Printer
Definition:
Thread.h:50
MutexLocker::Printer::m_name
const char * m_name
Definition:
Thread.h:56
Thread::RTThread
Definition:
Thread.h:29
Thread::m_type
Type m_type
Definition:
Thread.h:40
MutexLocker::Printer::Printer
Printer(const char *name)
Definition:
Thread.cpp:75
Thread::NonRTThread
Definition:
Thread.h:29
Thread
Definition:
Thread.h:24
MutexLocker::~MutexLocker
~MutexLocker()
Definition:
Thread.cpp:71
MutexLocker::m_locker
QMutexLocker m_locker
Definition:
Thread.h:61
Profiler
Profile point instance class.
Definition:
Profiler.h:86
base
Thread.h
Generated by
1.8.15