io/uring/Queue: use IntrusiveList<>

This commit is contained in:
Max Kellermann 2020-09-25 15:29:16 +02:00 committed by Max Kellermann
parent f64799622d
commit 3ac87bbcda
3 changed files with 6 additions and 11 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);