input/qobuz: use class IntrusiveList

This commit is contained in:
Max Kellermann 2021-02-24 20:30:54 +01:00
parent e406bdbb80
commit aa227cded1
1 changed files with 4 additions and 6 deletions

View File

@ -25,15 +25,14 @@
#include "lib/curl/Init.hxx" #include "lib/curl/Init.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "event/DeferEvent.hxx" #include "event/DeferEvent.hxx"
#include "util/IntrusiveList.hxx"
#include <boost/intrusive/list.hpp>
#include <memory> #include <memory>
#include <map> #include <map>
#include <string> #include <string>
class QobuzSessionHandler class QobuzSessionHandler
: public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::safe_link>> : public SafeLinkIntrusiveListHook
{ {
public: public:
virtual void OnQobuzSession() noexcept = 0; virtual void OnQobuzSession() noexcept = 0;
@ -59,8 +58,7 @@ class QobuzClient final : QobuzLoginHandler {
std::exception_ptr error; std::exception_ptr error;
typedef boost::intrusive::list<QobuzSessionHandler, using LoginHandlerList = IntrusiveList<QobuzSessionHandler>;
boost::intrusive::constant_time_size<false>> LoginHandlerList;
LoginHandlerList handlers; LoginHandlerList handlers;
@ -87,7 +85,7 @@ public:
void RemoveLoginHandler(QobuzSessionHandler &h) noexcept { void RemoveLoginHandler(QobuzSessionHandler &h) noexcept {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
if (h.is_linked()) if (h.is_linked())
handlers.erase(handlers.iterator_to(h)); h.unlink();
} }
/** /**