equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * CAThread |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __CATHREAD_H__ |
|
22 #define __CATHREAD_H__ |
|
23 |
|
24 /******************************************************************************* |
|
25 * |
|
26 * System Includes |
|
27 * |
|
28 ******************************************************************************/ |
|
29 #define _WINSOCK2API_ |
|
30 #include <windows.h> |
|
31 #include <stdio.h> |
|
32 #include <string> |
|
33 using namespace std; |
|
34 |
|
35 /******************************************************************************* |
|
36 * |
|
37 * Type |
|
38 * |
|
39 ******************************************************************************/ |
|
40 typedef enum { |
|
41 TS_INIT, |
|
42 TS_ACTIVE, |
|
43 TS_DONE |
|
44 } TThreadState; |
|
45 |
|
46 typedef enum { |
|
47 TE_NONE, |
|
48 TE_ERROR, |
|
49 TE_TIMEOUT, |
|
50 TE_INVALIDSTATE, |
|
51 } TThreadError; |
|
52 |
|
53 /******************************************************************************* |
|
54 * |
|
55 * Class Definition |
|
56 * |
|
57 ******************************************************************************/ |
|
58 class CAThread |
|
59 { |
|
60 public: |
|
61 CAThread(); |
|
62 CAThread( string aThreadName ); |
|
63 ~CAThread(); |
|
64 |
|
65 TThreadError StartThread( void *aStartProc, void *aArg, int *aSystemSpecificError ); |
|
66 TThreadError WaitForThread( int aTimeout ); |
|
67 TThreadState GetThreadState(); |
|
68 |
|
69 private: |
|
70 TThreadState iThreadState; |
|
71 HANDLE iThreadHandle; |
|
72 void *iProc; |
|
73 string iThreadName; |
|
74 }; |
|
75 |
|
76 #endif // __CATHREAD_H__ |