io/uring/Queue: use IntrusiveList<>
This commit is contained in:

committed by
Max Kellermann

parent
f64799622d
commit
3ac87bbcda
@@ -33,16 +33,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Operation.hxx"
|
#include "Operation.hxx"
|
||||||
|
#include "util/IntrusiveList.hxx"
|
||||||
#include <boost/intrusive/list_hook.hpp>
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace Uring {
|
namespace Uring {
|
||||||
|
|
||||||
class CancellableOperation
|
class CancellableOperation : public IntrusiveListHook
|
||||||
: public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>>
|
|
||||||
{
|
{
|
||||||
Operation *operation;
|
Operation *operation;
|
||||||
|
|
||||||
|
@@ -62,8 +62,8 @@ Queue::DispatchOneCompletion(struct io_uring_cqe &cqe) noexcept
|
|||||||
if (data != nullptr) {
|
if (data != nullptr) {
|
||||||
auto *c = (CancellableOperation *)data;
|
auto *c = (CancellableOperation *)data;
|
||||||
c->OnUringCompletion(cqe.res);
|
c->OnUringCompletion(cqe.res);
|
||||||
operations.erase_and_dispose(operations.iterator_to(*c),
|
c->unlink();
|
||||||
DeleteDisposer{});
|
delete c;
|
||||||
}
|
}
|
||||||
|
|
||||||
ring.SeenCompletion(cqe);
|
ring.SeenCompletion(cqe);
|
||||||
|
@@ -33,11 +33,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Ring.hxx"
|
#include "Ring.hxx"
|
||||||
|
#include "util/IntrusiveList.hxx"
|
||||||
|
|
||||||
#include <liburing.h>
|
#include <liburing.h>
|
||||||
|
|
||||||
#include <boost/intrusive/list.hpp>
|
|
||||||
|
|
||||||
namespace Uring {
|
namespace Uring {
|
||||||
|
|
||||||
class Operation;
|
class Operation;
|
||||||
@@ -50,9 +49,7 @@ class CancellableOperation;
|
|||||||
class Queue {
|
class Queue {
|
||||||
Ring ring;
|
Ring ring;
|
||||||
|
|
||||||
boost::intrusive::list<CancellableOperation,
|
IntrusiveList<CancellableOperation> operations;
|
||||||
boost::intrusive::base_hook<boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>>>,
|
|
||||||
boost::intrusive::constant_time_size<false>> operations;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Queue(unsigned entries, unsigned flags);
|
Queue(unsigned entries, unsigned flags);
|
||||||
|
Reference in New Issue
Block a user