input/tidal: use class IntrusiveList

This commit is contained in:
Max Kellermann 2021-02-24 20:23:45 +01:00
parent 1048f23680
commit e406bdbb80

View File

@ -24,8 +24,7 @@
#include "lib/curl/Init.hxx"
#include "thread/Mutex.hxx"
#include "event/DeferEvent.hxx"
#include <boost/intrusive/list.hpp>
#include "util/IntrusiveList.hxx"
#include <memory>
#include <string>
@ -36,7 +35,7 @@
* Its methods must be thread-safe.
*/
class TidalSessionHandler
: public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::safe_link>>
: public SafeLinkIntrusiveListHook
{
public:
/**
@ -84,8 +83,7 @@ class TidalSessionManager final : TidalLoginHandler {
*/
std::string session;
typedef boost::intrusive::list<TidalSessionHandler,
boost::intrusive::constant_time_size<false>> LoginHandlerList;
using LoginHandlerList = IntrusiveList<TidalSessionHandler>;
LoginHandlerList handlers;
@ -123,7 +121,7 @@ public:
void RemoveLoginHandler(TidalSessionHandler &h) noexcept {
const std::lock_guard<Mutex> protect(mutex);
if (h.is_linked())
handlers.erase(handlers.iterator_to(h));
h.unlink();
}
const char *GetToken() const noexcept {