Commit 3ac87bbc authored by Max Kellermann's avatar Max Kellermann Committed by Max Kellermann

io/uring/Queue: use IntrusiveList<>

parent f6479962
......@@ -33,16 +33,14 @@
#pragma once
#include "Operation.hxx"
#include <boost/intrusive/list_hook.hpp>
#include "util/IntrusiveList.hxx"
#include <cassert>
#include <utility>
namespace Uring {
class CancellableOperation
: public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>>
class CancellableOperation : public IntrusiveListHook
{
Operation *operation;
......
......@@ -62,8 +62,8 @@ Queue::DispatchOneCompletion(struct io_uring_cqe &cqe) noexcept
if (data != nullptr) {
auto *c = (CancellableOperation *)data;
c->OnUringCompletion(cqe.res);
operations.erase_and_dispose(operations.iterator_to(*c),
DeleteDisposer{});
c->unlink();
delete c;
}
ring.SeenCompletion(cqe);
......
......@@ -33,11 +33,10 @@
#pragma once
#include "Ring.hxx"
#include "util/IntrusiveList.hxx"
#include <liburing.h>
#include <boost/intrusive/list.hpp>
namespace Uring {
class Operation;
......@@ -50,9 +49,7 @@ class CancellableOperation;
class Queue {
Ring ring;
boost::intrusive::list<CancellableOperation,
boost::intrusive::base_hook<boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>>>,
boost::intrusive::constant_time_size<false>> operations;
IntrusiveList<CancellableOperation> operations;
public:
Queue(unsigned entries, unsigned flags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment