mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::fs::aio: Don't cancel requests which were already completed.
This commit is contained in:
parent
7aa9102f45
commit
9d59074679
2 changed files with 14 additions and 2 deletions
|
@ -345,6 +345,13 @@ ircd::fs::aio::request::operator()()
|
|||
return size_t(retval);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::fs::aio::request::completed()
|
||||
const
|
||||
{
|
||||
return retval != std::numeric_limits<decltype(retval)>::min();
|
||||
}
|
||||
|
||||
ircd::fs::const_iovec_view
|
||||
ircd::fs::aio::request::iovec()
|
||||
const
|
||||
|
@ -476,12 +483,16 @@ catch(const ctx::interrupted &e)
|
|||
// When the ctx is interrupted we're obligated to cancel the request.
|
||||
// The handler callstack is invoked directly from here by cancel() for
|
||||
// what it's worth but we rethrow the interrupt anyway.
|
||||
cancel(request);
|
||||
if(!request.completed())
|
||||
request.cancel();
|
||||
|
||||
throw;
|
||||
}
|
||||
catch(const ctx::terminated &)
|
||||
{
|
||||
cancel(request);
|
||||
if(!request.completed())
|
||||
request.cancel();
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ struct ircd::fs::aio::request
|
|||
|
||||
public:
|
||||
const_iovec_view iovec() const;
|
||||
bool completed() const;
|
||||
|
||||
size_t operator()();
|
||||
void cancel();
|
||||
|
|
Loading…
Reference in a new issue