Create Project for repo.or.cz
[vp.git] / test / thread_test.cpp
blob46840dcad39f2e84511666201dd7500ca38e76d7
1 /*******************************************************************************
2 * File Name : test/thread_test.cpp
3 *
4 * Author : Henry He
5 * Created Time : Fri 23 Oct 2009 10:55:14 AM CST
6 * Description :
7 ******************************************************************************/
10 /*******************************************************************************
11 * Desc : Includes Files
12 ******************************************************************************/
13 #include "src/common.h"
16 /*******************************************************************************
17 * Desc : Macro Definations
18 ******************************************************************************/
21 /*******************************************************************************
22 * Desc : Type Definations
23 ******************************************************************************/
26 /*******************************************************************************
27 * Desc : File Variables
28 ******************************************************************************/
33 /*******************************************************************************
34 * Desc : Functions
35 ******************************************************************************/
39 /******************************************************************************
40 * Func :
41 * Desc :
42 * Args :
43 * Outs :
44 ******************************************************************************/
45 void * MyThreadFunc (HLH_Thread &zhtThread, void *pvParam)
47 UINT32 nVal;
48 HLH_Time zhtTime;
51 zhtThread.ThreadStarted ();
53 nVal = (UINT32) pvParam;
55 Printf ("Enter: nVal = %08X\n", nVal);
57 do {
59 zhtTime.SetTime (2, 0);
60 HLH_Time::Wait (zhtTime);
62 if ( zhtThread.IsStopping () ) {
63 Printf ("Exit : nVal = %08X\n", nVal);
64 return NULL;
67 } while (1);
72 /******************************************************************************
73 * Func :
74 * Desc :
75 * Args :
76 * Outs :
77 ******************************************************************************/
78 int main ()
80 HLH_Thread zhtThread1;
81 HLH_Thread zhtThread2;
83 zhtThread1.Start (MyThreadFunc, (void*)0x1234);
84 zhtThread2.Start (MyThreadFunc, (void*)0x5678);
86 HLH_Time::Wait ( HLH_Time (5, 0) );
88 zhtThread1.Stop ();
89 zhtThread2.Stop ();
91 Printf ("Exit main\n");
93 return 0;