diff options
Diffstat (limited to 'include/cru/base/io')
-rw-r--r-- | include/cru/base/io/AutoReadStream.h | 6 | ||||
-rw-r--r-- | include/cru/base/io/Stream.h | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/include/cru/base/io/AutoReadStream.h b/include/cru/base/io/AutoReadStream.h index 759d5026..56e2beca 100644 --- a/include/cru/base/io/AutoReadStream.h +++ b/include/cru/base/io/AutoReadStream.h @@ -39,7 +39,7 @@ class CRU_BASE_API AutoReadStream : public Stream { * @param options Options to modify the behavior. */ AutoReadStream( - Stream* stream, bool auto_delete, + Stream* stream, bool auto_close, bool auto_delete, const AutoReadStreamOptions& options = AutoReadStreamOptions()); ~AutoReadStream() override; @@ -47,7 +47,7 @@ class CRU_BASE_API AutoReadStream : public Stream { public: CRU_STREAM_IMPLEMENT_CLOSE_BY_DO_CLOSE - void BeginToDrop(bool auto_delete = true); + void BeginToDrop(bool auto_close = true, bool auto_delete = true); protected: Index DoRead(std::byte* buffer, Index offset, Index size) override; @@ -61,11 +61,11 @@ class CRU_BASE_API AutoReadStream : public Stream { private: Stream* stream_; + bool auto_close_; bool auto_delete_; Index size_per_read_; std::unique_ptr<BufferStream> buffer_stream_; - std::mutex buffer_stream_mutex_; std::thread background_thread_; }; diff --git a/include/cru/base/io/Stream.h b/include/cru/base/io/Stream.h index e0b61627..0965cf22 100644 --- a/include/cru/base/io/Stream.h +++ b/include/cru/base/io/Stream.h @@ -26,11 +26,11 @@ class CRU_BASE_API StreamOperationNotSupportedException : public Exception { String operation_; }; -class CRU_BASE_API StreamAlreadyClosedException : public Exception { +class CRU_BASE_API StreamClosedException : public Exception { public: - StreamAlreadyClosedException(); + StreamClosedException(); - CRU_DEFAULT_DESTRUCTOR(StreamAlreadyClosedException) + CRU_DEFAULT_DESTRUCTOR(StreamClosedException) static void Check(bool closed); }; @@ -117,7 +117,7 @@ class CRU_BASE_API Stream : public Object { bool GetClosed() { return closed_; } void SetClosed(bool closed) { closed_ = closed; } - void CheckClosed() { StreamAlreadyClosedException::Check(closed_); } + void CheckClosed() { StreamClosedException::Check(closed_); } private: std::optional<SupportedOperations> supported_operations_; |