forked from yxkhuijie/ick
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIThread.cpp
More file actions
56 lines (47 loc) · 755 Bytes
/
IThread.cpp
File metadata and controls
56 lines (47 loc) · 755 Bytes
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
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "IThread.h"
#include <functional>
IThread::IThread()
{
#ifdef __windows__
this->m_thread = NULL;
#elif defined __linux__
this->m_thread = 0;
#endif
}
IThread::~IThread()
{
}
void IThread::start()
{
#ifdef _WINDOWS
m_thread = CreateThread(NULL, 0, ThreadHandler, this, 0, NULL);
#endif
}
#ifdef _WINDOWS
DWORD WINAPI IThread::ThreadHandler(LPVOID lpParamter)
{
IThread* pThread = (IThread*)lpParamter;
if (pThread != NULL)
{
pThread->m_state = THREAD_RUNNING;
pThread->execute();
}
return 0;
}
#endif
void IThread::stop()
{
}
void IThread::resume()
{
#ifdef __windows__ // resume thread for windows
if (this->m_thread != NULL)
{
::ResumeThread(this->m_thread);
}
#elif __linux__
if(this->m_thread != 0)
{
}
#endif
}