Thread.h

00001 /* START_LICENSE_HEADER
00002 
00003 Copyright (C) 2000 Martin Piper, original design and program code
00004 Copyright (C) 2001 Replica Software
00005 
00006 This program file is copyright (C) Replica Software and can only be used under license.
00007 For more information visit: http://www.replicanet.com/
00008 Or email: info@replicanet.com
00009 
00010 END_LICENSE_HEADER */
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 const int kReplicaNetPreferredProcessorOSChoice = -1;
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 
00056     bool GetTerminated(void);
00057 
00062     static int CallThreadEntry(ThreadClass *thread_class);
00063 
00068     bool GetIsRunning(void) const;
00069 
00074     void SetPreferredProcessor(int processor = kReplicaNetPreferredProcessorOSChoice);
00075 
00079     int GetPreferredProcessor(void);
00080 
00081 private:
00082     friend class ThreadClass;
00083     ThreadClass *mThreadClass;
00084 #if defined(_WIN32)
00085     void *mThreadHandle;
00086 //  unsigned long mThreadHandle;
00087 #endif
00088 #if defined(linux) || defined(unix)
00089     pthread_t mThreadHandle;
00090 #endif
00091 #if defined (_PS2)
00092     int mThreadHandle;
00093 #endif
00094 
00095     int mProcessor; // The preferred processor to run this thread on
00096 
00097     volatile bool mIsRunning;
00098     volatile bool mTerminateCalled;
00099 };
00100 
00101 } // namespace RNReplicaNet
00102 
00103 #endif

Generated on Sat Jun 28 22:02:16 2008 for ReplicaNet and RNLobby by  doxygen 1.5.3