xref: /third_party/lzma/CPP/7zip/Common/VirtThread.h
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/lzma/CPP/7zip/Common/
1370b324cSopenharmony_ci// VirtThread.h
2370b324cSopenharmony_ci
3370b324cSopenharmony_ci#ifndef ZIP7_INC_VIRT_THREAD_H
4370b324cSopenharmony_ci#define ZIP7_INC_VIRT_THREAD_H
5370b324cSopenharmony_ci
6370b324cSopenharmony_ci#include "../../Windows/Synchronization.h"
7370b324cSopenharmony_ci#include "../../Windows/Thread.h"
8370b324cSopenharmony_ci
9370b324cSopenharmony_cistruct CVirtThread
10370b324cSopenharmony_ci{
11370b324cSopenharmony_ci  NWindows::NSynchronization::CAutoResetEvent StartEvent;
12370b324cSopenharmony_ci  NWindows::NSynchronization::CAutoResetEvent FinishedEvent;
13370b324cSopenharmony_ci  NWindows::CThread Thread;
14370b324cSopenharmony_ci  bool Exit;
15370b324cSopenharmony_ci
16370b324cSopenharmony_ci  virtual ~CVirtThread() { WaitThreadFinish(); }
17370b324cSopenharmony_ci  void WaitThreadFinish(); // call it in destructor of child class !
18370b324cSopenharmony_ci  WRes Create();
19370b324cSopenharmony_ci  WRes Start();
20370b324cSopenharmony_ci  virtual void Execute() = 0;
21370b324cSopenharmony_ci  WRes WaitExecuteFinish() { return FinishedEvent.Lock(); }
22370b324cSopenharmony_ci};
23370b324cSopenharmony_ci
24370b324cSopenharmony_ci#endif
25

Indexes created Thu Nov 07 10:32:03 CST 2024