Go to the documentation of this file.00001 #ifndef __THREAD_ABSTRACTION_H__
00002 #define __THREAD_ABSTRACTION_H__
00003
00004 #if !defined( WIN32_PLATFORM ) && !defined( NIX_PLATFORM ) && !defined( MINGW_PLATFORM ) && !defined( CYGWIN_PLATFORM )
00005 #define WIN32_PLATFORM
00006 #endif
00007
00008 #include <utilities/exception.h>
00009
00010 #if ( defined( WIN32_PLATFORM ) || defined( MINGW_PLATFORM ) ) && !defined( __AFX_H__ )
00011 #include <utilities/nwindows.h>
00012 #include <windef.h>
00013 #endif
00014
00015 #if defined( CYGWIN_PLATFORM ) || defined( NIX_PLATFORM )
00016 #include <unistd.h>
00017 #endif
00018
00019 #if defined( NIX_PLATFORM )
00020 #define THREAD_ABSTRACTION_DLL_ENTITY
00021 #endif
00022
00023 #ifdef THREAD_ABSTRACTION
00024 #if defined( WIN32_PLATFORM ) || defined( MINGW_PLATFORM ) || defined( CYGWIN_PLATFORM )
00025 #define THREAD_ABSTRACTION_DLL_ENTITY __declspec( dllexport )
00026 #endif
00027 #else
00028 #if defined( WIN32_PLATFORM )
00029 #define THREAD_ABSTRACTION_DLL_ENTITY __declspec( dllimport )
00030 #pragma comment( lib , "thread_abstraction.lib" )
00031 #endif
00032
00033 #if defined( CYGWIN_PLATFORM ) || defined( MINGW_PLATFORM )
00034 #define THREAD_ABSTRACTION_DLL_ENTITY __declspec( dllimport )
00035 #endif
00036 #endif
00037
00038 namespace nitro
00039 {
00052 class THREAD_ABSTRACTION_DLL_ENTITY ThreadAbstraction{
00053
00054 public:
00055
00070 ThreadAbstraction( void );
00071
00094 void CreateThread( void * ( * theThreadFunction )( void * ) , void * theThreadParam );
00095
00110 void Release( void );
00111
00130 static void Sleep( std::size_t Milliseconds );
00131
00142 ~ThreadAbstraction();
00143
00144 private:
00145
00156 void * ThreadData;
00157
00168 void * ThreadParam;
00169
00180 void * ( * ThreadFunction )( void * );
00181
00196 ThreadAbstraction operator=( const ThreadAbstraction & Thread ){return( *this );}
00197
00212 ThreadAbstraction( const ThreadAbstraction & Thread ){}
00213
00214 #if defined( WIN32_PLATFORM ) || defined( MINGW_PLATFORM )
00215
00230 friend DWORD WinThreadFunction( LPVOID Data );
00231
00232 #endif
00233 };
00234 }
00235
00236 #endif