Thread.h
author sl
Sun, 16 Mar 2014 09:11:39 +0100
changeset 0 523a7dc3469f
permissions -rw-r--r--
First contribution.
     1 //------------------------------------------------------------------------------
     2 #ifndef THREAD_H_INCLUDED
     3 #define THREAD_H_INCLUDED
     4 //------------------------------------------------------------------------------
     5 #include <windows.h>
     6 //------------------------------------------------------------------------------
     7 class Thread
     8 {
     9 protected:
    10   Thread();
    11   virtual ~Thread();
    12 
    13 private:
    14   Thread(const Thread& other) {}
    15   Thread& operator=(const Thread& other) { *this; }
    16 
    17 public:
    18   void Start();
    19   virtual void Interrupt() = 0;
    20   void Join() const;  
    21 
    22 protected:
    23   virtual void Run() = 0;
    24 
    25 private:
    26   static DWORD WINAPI ThreadProc(LPVOID lpParam);
    27 
    28 private:
    29   HANDLE m_hThread;
    30   DWORD m_dwThreadId;
    31 };
    32 //------------------------------------------------------------------------------
    33 #endif
    34 //------------------------------------------------------------------------------