Files

25 lines
592 B
C
Raw Permalink Normal View History

2021-10-19 21:27:23 +01:00
// VirtThread.h
2023-09-24 03:13:03 +01:00
#ifndef ZIP7_INC_VIRT_THREAD_H
#define ZIP7_INC_VIRT_THREAD_H
2021-10-19 21:27:23 +01:00
#include "../../Windows/Synchronization.h"
#include "../../Windows/Thread.h"
struct CVirtThread
{
NWindows::NSynchronization::CAutoResetEvent StartEvent;
NWindows::NSynchronization::CAutoResetEvent FinishedEvent;
NWindows::CThread Thread;
bool Exit;
2023-09-24 03:13:03 +01:00
virtual ~CVirtThread() { WaitThreadFinish(); }
2021-10-19 21:27:23 +01:00
void WaitThreadFinish(); // call it in destructor of child class !
WRes Create();
WRes Start();
virtual void Execute() = 0;
WRes WaitExecuteFinish() { return FinishedEvent.Lock(); }
};
#endif