MythTV
master
libs
libmythbase
mthread.h
Go to the documentation of this file.
1
#ifndef _MYTH_THREAD_H_
2
#define _MYTH_THREAD_H_
3
4
#include <QThread>
5
6
#include "
mythbaseexp.h
"
7
8
class
MThreadInternal
;
9
class
QStringList;
10
class
QRunnable;
11
class
MThread
;
12
14
bool
MBASE_PUBLIC
is_current_thread
(
MThread
*thread);
16
bool
MBASE_PUBLIC
is_current_thread
(QThread *thread);
18
bool
MBASE_PUBLIC
is_current_thread
(
MThread
&thread);
19
46
class
MBASE_PUBLIC
MThread
47
{
48
friend
class
MThreadInternal
;
49
public
:
51
explicit
MThread
(
const
QString &objectName);
56
explicit
MThread
(
const
QString &objectName, QRunnable *runnable);
57
virtual
~
MThread
();
58
60
void
RunProlog(
void
);
63
void
RunEpilog(
void
);
64
67
QThread *qthread(
void
);
68
69
void
setObjectName(
const
QString &
name
);
70
QString objectName(
void
)
const
;
71
72
void
setPriority(QThread::Priority priority);
73
QThread::Priority priority(
void
)
const
;
74
75
bool
isFinished(
void
)
const
;
76
bool
isRunning
(
void
)
const
;
77
78
void
setStackSize(
uint
stackSize);
79
uint
stackSize(
void
)
const
;
80
82
void
exit(
int
retcode = 0);
84
void
start(QThread::Priority = QThread::InheritPriority);
92
void
terminate(
void
);
93
void
quit
(
void
);
94
97
static
void
ThreadSetup(
const
QString&);
100
static
void
ThreadCleanup(
void
);
101
102
public
:
105
bool
wait(
unsigned
long
time = ULONG_MAX);
106
110
static
void
Cleanup(
void
);
111
static
void
GetAllThreadNames(QStringList &list);
112
static
void
GetAllRunningThreadNames(QStringList &list);
113
114
static
const
int
kDefaultStartTimeout
;
115
protected
:
121
virtual
void
run
(
void
);
123
int
exec
(
void
);
124
125
static
void
setTerminationEnabled(
bool
enabled =
true
);
126
static
void
sleep
(
unsigned
long
time);
127
static
void
msleep(
unsigned
long
time);
128
static
void
usleep(
unsigned
long
time);
129
130
MThreadInternal
*
m_thread
;
131
QRunnable *
m_runnable
;
132
bool
m_prolog_executed
;
133
bool
m_epilog_executed
;
134
};
135
136
#endif // _MYTH_THREAD_H_
MThread
This is a wrapper around QThread that does several additional things.
Definition:
mthread.h:46
MThread::m_thread
MThreadInternal * m_thread
Definition:
mthread.h:130
mythbaseexp.h
MThread::kDefaultStartTimeout
static const int kDefaultStartTimeout
Definition:
mthread.h:114
uint
unsigned int uint
Definition:
compat.h:140
MThread::m_epilog_executed
bool m_epilog_executed
Definition:
mthread.h:133
is_current_thread
bool MBASE_PUBLIC is_current_thread(MThread *thread)
Use this to determine if you are in the named thread.
Definition:
mthread.cpp:41
MThreadInternal::exec
int exec(void)
Definition:
mthread.cpp:82
sleep
unsigned sleep(unsigned int x)
Definition:
compat.h:152
MThread::m_runnable
QRunnable * m_runnable
Definition:
mthread.h:131
MBASE_PUBLIC
#define MBASE_PUBLIC
Definition:
mythbaseexp.h:15
MThreadInternal
Definition:
mthread.cpp:75
run
static int run(MythMediaDevice *dev=nullptr, bool startRandomShow=false)
Definition:
mythplugins/mythgallery/mythgallery/main.cpp:28
isRunning
static bool isRunning(const char *program)
Returns true if a program containing the specified string is running on this machine.
Definition:
mythtv/programs/mythshutdown/main.cpp:203
quit
Definition:
lirc_client.h:34
MThread::m_prolog_executed
bool m_prolog_executed
Definition:
mthread.h:132
name
const char * name
Definition:
ParseText.cpp:339
Generated on Sat Oct 5 2019 05:30:16 for MythTV by
1.8.15