My Project
D:/source/c++/Programme/sally/sally/sallyAPI/Thread.h
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 #pragma once
00029 #include "Define.h"
00030 #include "SystemHelper.h"
00031 #include "AutoLock.h"
00032 #include "CritSection.h"
00033 
00034 namespace SallyAPI
00035 {
00036         namespace System
00037         {
00044 
00045                 enum ThreadStatus {THREAD_STOPPED, THREAD_RUNNING};
00046 
00056 
00057                 class DLL_API_SALLY CThread
00058                 {
00059                 protected:
00060                         ThreadStatus                                            m_eStatus;
00061                         HANDLE                                                          m_hThread;
00062                         bool                                                            m_bPleaseStop;
00063                         SallyAPI::System::CCritSection          m_Lock;
00064                         std::string                                                     m_strId;
00065 
00066                         static DWORD WINAPI     Thread(PVOID pvoid);
00067                         virtual void    RunEx() = 0;
00068                         void                    Run();
00069                 public:
00070                         CThread();
00071                         virtual ~CThread();
00072 
00073                         ThreadStatus    GetStatus();
00074                         virtual void    Start();
00075                         virtual void    Stop(bool force = false);
00076                         virtual void    WaitForStop(bool force = false);
00077                         std::string             GetId();
00078                 };
00079         }
00080 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines