-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathThreadUser.h
43 lines (41 loc) · 1.24 KB
/
ThreadUser.h
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
43
#pragma once
#include "ThreadPool.h"
#include "ThreadWorkerController.h"
#include <QDebug>
namespace TaoThread
{
class ThreadUser : public QObject
{
Q_OBJECT
public:
ThreadUser(int id)
{
m_id = id;
// ThreadPool::getInstance()->work(
// [id](){
// qWarning() << QThread::currentThreadId() << "do" << id;
// return true;
// },
// [this, id](bool result){
// qWarning() <<QThread::currentThreadId() << "work result:" << result << id;
// showId();
// });
ThreadController::getInstance()->work(
[id](){
qWarning() << QThread::currentThreadId() << "do" << id;
return true;
},
[this, id](bool result){
qWarning() <<QThread::currentThreadId() << "work result:" << result << id;
showId();
}
);
}
void showId()
{
qWarning() << QThread::currentThreadId() << "showID " << m_id;
}
private:
int m_id;
};
}