锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久精品中文无码资源站,久久夜色精品国产噜噜亚洲a,亚洲中文字幕无码久久2020http://m.shnenglu.com/bujiwu/category/11802.htmlzh-cnTue, 15 Sep 2009 15:04:33 GMTTue, 15 Sep 2009 15:04:33 GMT60- 綆鍗曠嚎紼嬪熀綾?/title>http://m.shnenglu.com/bujiwu/archive/2009/09/15/CreateThread.htmlbujiwubujiwuTue, 15 Sep 2009 13:37:00 GMThttp://m.shnenglu.com/bujiwu/archive/2009/09/15/CreateThread.htmlhttp://m.shnenglu.com/bujiwu/comments/96343.htmlhttp://m.shnenglu.com/bujiwu/archive/2009/09/15/CreateThread.html#Feedback0http://m.shnenglu.com/bujiwu/comments/commentRss/96343.htmlhttp://m.shnenglu.com/bujiwu/services/trackbacks/96343.htmlhttp://blog.csdn.net/wei801004/archive/2006/05/18/744341.aspx
http://blog.csdn.net/SeaWave/archive/2006/05/20/746399.aspx
1 #include <iostream>
2 #include <Windows.h>
3 #include <process.h>
4 #include <conio.h>
5
6 using namespace std;
7
8 class CThread
9 {
10 public:
11 CThread(void)
12 {
13 m_running = true;
14 }
15
16 virtual ~CThread(void)
17 {
18 }
19
20 void StartThread(void);
21 void StopThread(void);
22
23 void WaitForEnd(DWORD dwTimeOut = INFINITE);
24
25 virtual DWORD WINAPI ThreadWorkItem(LPVOID lpParameter) = 0;
26
27 private:
28 static DWORD WINAPI ThreadFun(LPVOID lpParameter);
29
30 protected:
31 bool m_running;
32
33 private:
34 HANDLE m_hThread;
35 };
36
37 inline void CThread::StartThread(void)
38 {
39 m_hThread = CreateThread(NULL, 0, ThreadFun, this, 0, 0);
40
41 if (m_hThread == NULL)
42 {
43 throw exception("Error: Start thread!");
44 }
45
46 CloseHandle(m_hThread);
47
48 return;
49 }
50
51 inline void CThread::WaitForEnd(DWORD dwTimeOut /* = INFINITE */)
52 {
53 DWORD dwRet = WaitForSingleObject(m_hThread, dwTimeOut);
54
55 if (dwRet == WAIT_OBJECT_0)
56 {
57 CloseHandle(m_hThread);
58 m_hThread = NULL;
59 }
60 else if (dwRet == WAIT_TIMEOUT)
61 {
62 throw exception("Error: Time out!");
63 }
64
65 return;
66 }
67
68 inline void CThread::StopThread()
69 {
70 m_running = false;
71 }
72
73 inline DWORD WINAPI CThread::ThreadFun(LPVOID lpParameter)
74 {
75 CThread *pThread = reinterpret_cast<CThread*> (lpParameter);
76 pThread->ThreadWorkItem(lpParameter);
77
78 return 0;
79 }
80
81 class SubThread : public CThread
82 {
83 public:
84 SubThread(int Num)
85 {
86 Start = Num;
87 }
88
89 DWORD WINAPI ThreadWorkItem(LPVOID lpParameter)
90 {
91 while ( m_running )
92 {
93 cout << "綰跨▼鎵ц鐨勬搷浣淸" << Start++ << "]" <<endl;
94 Sleep(1000);
95 }
96
97 ExitThread(0);
98
99 return 0;
100 }
101
102 private:
103 int Start;
104 };
105
106 int main(int argc, char* argv[])
107 {
108 SubThread MyThead(1);
109
110 cout << "To exit this server, hit a key at any time on this console
" <<endl;
111
112 MyThead.StartThread();
113 //MyThead.WaitForEnd();
114
115 while(!_kbhit())
116 {
117 Sleep(0);
118 }
119
120 MyThead.StopThread();
121
122 return 0;
123 }
124
http://m.shnenglu.com/Files/bujiwu/CThread.rar

]]>
无码AV波多野结衣久久|
青青草国产97免久久费观看|
久久精品国产亚洲av麻豆图片|
久久这里都是精品|
久久夜色精品国产噜噜麻豆|
91精品观看91久久久久久|
亚洲一区精品伊人久久伊人|
久久综合狠狠综合久久综合88|
岛国搬运www久久|
亚洲成色WWW久久网站|
精品99久久aaa一级毛片|
久久国产色av免费看|
精品国产综合区久久久久久|
97精品伊人久久久大香线蕉
|
亚洲欧美成人久久综合中文网|
久久久www免费人成精品|
蜜桃麻豆www久久|
蜜臀久久99精品久久久久久小说
|
99久久亚洲综合精品成人|
亚洲国产日韩欧美综合久久|
久久福利青草精品资源站|
日本亚洲色大成网站WWW久久|
99久久超碰中文字幕伊人|
久久久国产打桩机|
亚洲欧洲久久av|
久久久噜噜噜久久中文字幕色伊伊|
国产精品美女久久久m|
一本色道久久99一综合|
2021国内精品久久久久久影院|
国产精品女同一区二区久久|
久久综合久久久|
国产99久久九九精品无码|
久久电影网2021|
99久久国产免费福利|
日本道色综合久久影院|
嫩草影院久久国产精品|
国产精品久久自在自线观看|
久久精品国产69国产精品亚洲|
国产精品99久久精品|
久久久久久久尹人综合网亚洲|
久久国产乱子精品免费女|