00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __THREAD_H__
00012 #define __THREAD_H__
00013 #include "RNPlatform/Inc/DLLExportAPI.h"
00014
00015 #if defined(linux) || defined(unix)
00016 #include <pthread.h>
00017 #endif
00018
00019 namespace RNReplicaNet
00020 {
00021
00022 class ThreadClass;
00023
00028 class REPNETEXPORTAPI Thread
00029 {
00030 public:
00034 Thread();
00035
00039 virtual ~Thread();
00040
00046 void Begin(ThreadClass *threaded_class);
00047
00051 void Terminate(void);
00052
00057 static int CallThreadEntry(ThreadClass *thread_class);
00058
00063 bool GetIsRunning(void) const;
00064
00065
00066 private:
00067 ThreadClass *mThreadClass;
00068 #if defined(_WIN32)
00069 void *mThreadHandle;
00070
00071 #endif
00072 #if defined(linux) || defined(unix)
00073 pthread_t mThreadHandle;
00074 #endif
00075 #if defined (_PS2)
00076 int mThreadHandle;
00077 #endif
00078
00079 volatile bool mIsRunning;
00080 };
00081
00082 }
00083
00084 #endif