io/uring/CancellableOperation: invoke OnUringCompletion() in destructor
This is important for operations that have complex cancellation procedures (e.g. if they need to free buffers). They might leave an Operation instance in the queue.
This commit is contained in:
parent
e014d31972
commit
45644759fe
@ -10,6 +10,8 @@
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
|
||||
#include <errno.h> // for ECANCELED
|
||||
|
||||
namespace Uring {
|
||||
|
||||
class CancellableOperation
|
||||
@ -26,7 +28,8 @@ public:
|
||||
}
|
||||
|
||||
~CancellableOperation() noexcept {
|
||||
assert(operation == nullptr);
|
||||
if (operation != nullptr)
|
||||
operation->OnUringCompletion(-ECANCELED);
|
||||
}
|
||||
|
||||
void Cancel(Operation &_operation) noexcept {
|
||||
|
Loading…
x
Reference in New Issue
Block a user