testexecmgmt/ucc/Source/ThreadLibrary/CAThread.h
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     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 #ifdef WIN32
       
    30 #include <windows.h>
       
    31 #endif
       
    32 #include <stdio.h>
       
    33 #include <string>
       
    34 using namespace std;
       
    35 
       
    36 /*******************************************************************************
       
    37  *
       
    38  * Types
       
    39  *
       
    40  ******************************************************************************/
       
    41 #ifndef WIN32
       
    42 #define INFINITE (-1)
       
    43 typedef pthread_t HANDLE;
       
    44 #endif
       
    45 
       
    46 /*******************************************************************************
       
    47  *
       
    48  * Type
       
    49  *
       
    50  ******************************************************************************/
       
    51 typedef enum {
       
    52 	TS_INIT,
       
    53 	TS_ACTIVE,
       
    54 	TS_DONE
       
    55 } TThreadState;
       
    56 
       
    57 typedef enum {
       
    58 	TE_NONE,
       
    59 	TE_ERROR,
       
    60 	TE_TIMEOUT,
       
    61 	TE_INVALIDSTATE,
       
    62 } TThreadError;
       
    63 
       
    64 /*******************************************************************************
       
    65  *
       
    66  * Class Definition
       
    67  *
       
    68  ******************************************************************************/
       
    69 class CAThread
       
    70 {
       
    71 public:
       
    72 	CAThread();
       
    73 	CAThread( string aThreadName );
       
    74 	~CAThread();
       
    75 
       
    76 	TThreadError StartThread( void *aStartProc, void *aArg, int *aSystemSpecificError );
       
    77 	TThreadError WaitForThread( int aTimeout );
       
    78 	TThreadState GetThreadState();
       
    79 
       
    80 private:
       
    81 	TThreadState iThreadState;
       
    82 	HANDLE iThreadHandle;
       
    83 	void *iProc;
       
    84 	string iThreadName;
       
    85 };
       
    86 
       
    87 #endif // __CATHREAD_H__