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