io/uring/Operation: add API documentation

This commit is contained in:
Max Kellermann 2020-09-10 15:20:21 +02:00 committed by Max Kellermann
parent 85af4d6916
commit 382273abc5

View File

@ -36,6 +36,9 @@ namespace Uring {
class CancellableOperation;
/**
* An asynchronous I/O operation to be queued in a #Queue instance.
*/
class Operation {
friend class CancellableOperation;
@ -46,12 +49,26 @@ public:
CancelUring();
}
/**
* Are we waiting for the operation to complete?
*/
bool IsUringPending() const noexcept {
return cancellable != nullptr;
}
/**
* Cancel the operation. OnUringCompletion() will not be
* invoked. This is a no-op if none is pending.
*/
void CancelUring() noexcept;
/**
* This method is called when the operation completes.
*
* @param res the result code; the meaning is specific to the
* operation, but negative values usually mean an error has
* occurred
*/
virtual void OnUringCompletion(int res) noexcept = 0;
};