• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // VirtThread.h
2 
3 #ifndef __VIRT_THREAD_H
4 #define __VIRT_THREAD_H
5 
6 #include "../../Windows/Synchronization.h"
7 #include "../../Windows/Thread.h"
8 
9 struct CVirtThread
10 {
11   NWindows::NSynchronization::CAutoResetEvent StartEvent;
12   NWindows::NSynchronization::CAutoResetEvent FinishedEvent;
13   NWindows::CThread Thread;
14   bool Exit;
15 
~CVirtThreadCVirtThread16   ~CVirtThread() { WaitThreadFinish(); }
17   void WaitThreadFinish(); // call it in destructor of child class !
18   WRes Create();
19   void Start();
20   virtual void Execute() = 0;
WaitExecuteFinishCVirtThread21   void WaitExecuteFinish() { FinishedEvent.Lock(); }
22 };
23 
24 #endif
25