diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2011-04-11 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:05 +0300 |
commit | 35596517f203f1c4970413b3b5b2e216b849e462 (patch) | |
tree | 93240df3eb4ddbd8eebbe6a5fc65e93f2ccb6495 /CPP/7zip/Common/StreamBinder.h | |
parent | de4f8c22fe4b9e59b60495b84db2e81de50999a9 (diff) |
9.219.21
Diffstat (limited to 'CPP/7zip/Common/StreamBinder.h')
-rwxr-xr-x | CPP/7zip/Common/StreamBinder.h | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/CPP/7zip/Common/StreamBinder.h b/CPP/7zip/Common/StreamBinder.h index 48f68e60..f3fb5322 100755 --- a/CPP/7zip/Common/StreamBinder.h +++ b/CPP/7zip/Common/StreamBinder.h @@ -1,32 +1,34 @@ // StreamBinder.h -#ifndef __STREAMBINDER_H -#define __STREAMBINDER_H +#ifndef __STREAM_BINDER_H +#define __STREAM_BINDER_H -#include "../IStream.h" #include "../../Windows/Synchronization.h" +#include "../IStream.h" + class CStreamBinder { - NWindows::NSynchronization::CManualResetEvent _allBytesAreWritenEvent; - NWindows::NSynchronization::CManualResetEvent _thereAreBytesToReadEvent; - NWindows::NSynchronization::CManualResetEvent _readStreamIsClosedEvent; - UInt32 _bufferSize; - const void *_buffer; + NWindows::NSynchronization::CManualResetEvent _canWrite_Event; + NWindows::NSynchronization::CManualResetEvent _canRead_Event; + NWindows::NSynchronization::CManualResetEvent _readingWasClosed_Event; + bool _waitWrite; + UInt32 _bufSize; + const void *_buf; public: - // bool ReadingWasClosed; UInt64 ProcessedSize; - CStreamBinder() {} - HRes CreateEvents(); - void CreateStreams(ISequentialInStream **inStream, - ISequentialOutStream **outStream); + WRes CreateEvents(); + void CreateStreams(ISequentialInStream **inStream, ISequentialOutStream **outStream); + void ReInit(); HRESULT Read(void *data, UInt32 size, UInt32 *processedSize); - void CloseRead(); - HRESULT Write(const void *data, UInt32 size, UInt32 *processedSize); - void CloseWrite(); - void ReInit(); + void CloseRead() { _readingWasClosed_Event.Set(); } + void CloseWrite() + { + // _bufSize must be = 0 + _canRead_Event.Set(); + } }; #endif |