锘??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

]]>
久久露脸国产精品|
久久综合给久久狠狠97色|
丰满少妇人妻久久久久久4|
久久本道久久综合伊人|
思思久久99热只有频精品66|
久久精品国产亚洲AV蜜臀色欲|
久久国产色AV免费观看|
久久无码人妻精品一区二区三区|
久久久SS麻豆欧美国产日韩|
国产精品热久久毛片|
久久久久久久精品妇女99|
亚洲国产精品久久|
久久精品无码一区二区WWW|
夜夜亚洲天天久久|
久久婷婷五月综合国产尤物app|
久久国产免费直播|
99精品国产在热久久无毒不卡|
日韩久久无码免费毛片软件
|
久久国产影院|
99久久精品国产麻豆|
亚洲欧美伊人久久综合一区二区
|
国产伊人久久|
久久人人妻人人爽人人爽|
少妇久久久久久被弄到高潮|
国产69精品久久久久99尤物|
久久国产精品99国产精|
无码精品久久久久久人妻中字|
久久夜色精品国产|
久久国产成人精品国产成人亚洲|
www.久久精品|
免费国产99久久久香蕉|
国产成人精品久久免费动漫|
99久久精品国产免看国产一区|
一本久久知道综合久久|
一本久道久久综合狠狠爱|
偷窥少妇久久久久久久久|
国产69精品久久久久APP下载
|
男女久久久国产一区二区三区|
7777精品久久久大香线蕉|
亚洲αv久久久噜噜噜噜噜|
天天躁日日躁狠狠久久|