include/df/thread.hpp

00001 //DF/1.3.1 - if THREADMANAGER_VDTOR is defined then threads
00002 //  are deleted thru the base class pointer and a virtual dtor is defined
00003 //  in the Thread class to allow inherited classes to dtor properly.
00004 //#define THREADMANAGER_VDTOR    //use virtual dtor method to delete threads
00005 // Presently though I don't see an advantage to using this, it actually
00006 // slows things down because of another jmp thru the vtable.
00007 
00008 class Thread : public SystemCode {
00009     friend class SystemCode;
00010     friend class ThreadManager;
00011     friend class ExclusiveThread;
00012     friend class OpenSSL;
00013     friend class OpenSSLSession;
00014   _PROTECTED_:
00015     int ThreadStatus;   //-1=paused 0=init 1=Running 2=in Exit() 3=Exit() complete
00016     int ThreadExitCode;
00017     int32 ThreadMainParam;
00018     String LastErrorMsg;          //"" at startup (empty)
00019 #ifdef DF_LNX
00020     void *queue;   //events per thread
00021     void *cond;    //pthread_cond_...
00022     void *mutex;   //pthread_mutex_...
00023 #endif
00024   public:
00025     uint32 __StartThread();
00026     uint32 ThreadID;      //Win32 only (Linux uses same value as ThreadHandle)
00027     uint32 ThreadHandle;  //pthread_t in Linux
00028     //Event handlers
00029     virtual BOOL Event(Element *id, int msg, int x, int y, int flgs);
00030     virtual BOOL Event(Network *id, int msg, int x, int y, int flgs);
00031     virtual BOOL Event(Thread *id, int msg, int x, int y, int flgs);
00032     //LastError (Thread specific)
00033     void SetLastErrorMsg(char *, ...);
00034     char *GetLastErrorMsg();
00035     void SetLastError(uint32);
00036     uint32 GetLastError();
00037     //Main definition
00038     virtual uint32 Main(int32);
00039     //vdtor
00040 #ifdef THREADMANAGER_VDTOR
00041     virtual ~Thread();
00042 #endif
00043 };

Generated on Mon Mar 5 09:49:14 2007 for DigiForce by  doxygen 1.4.7