1// CrossThreadProgress.h
2
3#ifndef __CROSSTHREADPROGRESS_H
4#define __CROSSTHREADPROGRESS_H
5
6#include "../../ICoder.h"
7#include "../../../Windows/Synchronization.h"
8#include "../../../Common/MyCom.h"
9
10class CCrossThreadProgress:
11  public ICompressProgressInfo,
12  public CMyUnknownImp
13{
14public:
15  const UInt64 *InSize;
16  const UInt64 *OutSize;
17  HRESULT Result;
18  NWindows::NSynchronization::CAutoResetEvent ProgressEvent;
19  NWindows::NSynchronization::CAutoResetEvent WaitEvent;
20
21  HRes Create()
22  {
23    RINOK(ProgressEvent.CreateIfNotCreated());
24    return WaitEvent.CreateIfNotCreated();
25  }
26  void Init()
27  {
28    ProgressEvent.Reset();
29    WaitEvent.Reset();
30  }
31
32  MY_UNKNOWN_IMP
33
34  STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
35};
36
37#endif
38