-
Notifications
You must be signed in to change notification settings - Fork 5
/
mythread.cpp
42 lines (33 loc) · 1.38 KB
/
mythread.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "display.h"
#include "mythread.h"
/*=================================================================================================================================*/
// class MyThread-Specific Methods
/*=================================================================================================================================*/
/*.------------------------.*/
/*| Constructor |*/
/*'------------------------'*/
// PURPOSE: constructor for creating a thread
MyThread::MyThread(QObject * pObj) {
m_pReciever = pObj;
m_exit = false;
connect(this, SIGNAL(mysignal()), m_pReciever, SLOT(slot_refreshThread()));
}
/*=================================================================================================================================*/
/*.------------------------.*/
/*| Mutators |*/
/*'------------------------'*/
// PURPOSE: exits the thread.
void MyThread::performExit() {
m_exit = true;
}
/*=================================================================================================================================*/
/*.------------------------.*/
/*| Virtual Methods |*/
/*'------------------------'*/
// PURPOSE: overrides the run function.
void MyThread::run() {
while (!m_exit) {
sleep(3); // in seconds. msleep() for msecs.
emit mysignal();
}
}