input/async: add attribute "postponed_exception"
Will replace "postponed_error".
This commit is contained in:
parent
6ed77f2a27
commit
8092e18158
@ -88,6 +88,12 @@ AsyncInputStream::Resume()
|
|||||||
bool
|
bool
|
||||||
AsyncInputStream::Check(Error &error)
|
AsyncInputStream::Check(Error &error)
|
||||||
{
|
{
|
||||||
|
if (postponed_exception) {
|
||||||
|
auto e = std::move(postponed_exception);
|
||||||
|
postponed_exception = std::exception_ptr();
|
||||||
|
std::rethrow_exception(e);
|
||||||
|
}
|
||||||
|
|
||||||
bool success = !postponed_error.IsDefined();
|
bool success = !postponed_error.IsDefined();
|
||||||
if (!success) {
|
if (!success) {
|
||||||
error = std::move(postponed_error);
|
error = std::move(postponed_error);
|
||||||
@ -181,6 +187,7 @@ bool
|
|||||||
AsyncInputStream::IsAvailable()
|
AsyncInputStream::IsAvailable()
|
||||||
{
|
{
|
||||||
return postponed_error.IsDefined() ||
|
return postponed_error.IsDefined() ||
|
||||||
|
postponed_exception ||
|
||||||
IsEOF() ||
|
IsEOF() ||
|
||||||
!buffer.IsEmpty();
|
!buffer.IsEmpty();
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include "util/CircularBuffer.hxx"
|
#include "util/CircularBuffer.hxx"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class for moving asynchronous (non-blocking) InputStream
|
* Helper class for moving asynchronous (non-blocking) InputStream
|
||||||
* implementations to the I/O thread. Data is being read into a ring
|
* implementations to the I/O thread. Data is being read into a ring
|
||||||
@ -67,6 +69,8 @@ class AsyncInputStream : public InputStream {
|
|||||||
protected:
|
protected:
|
||||||
Error postponed_error;
|
Error postponed_error;
|
||||||
|
|
||||||
|
std::exception_ptr postponed_exception;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @param _buffer a buffer allocated with HugeAllocate(); the
|
* @param _buffer a buffer allocated with HugeAllocate(); the
|
||||||
|
Loading…
Reference in New Issue
Block a user