Commit aa227cde authored by Max Kellermann's avatar Max Kellermann

input/qobuz: use class IntrusiveList

parent e406bdbb
...@@ -25,15 +25,14 @@ ...@@ -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 { ...@@ -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: ...@@ -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();
} }
/** /**
......
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