input/tidal: use class IntrusiveList
This commit is contained in:
parent
1048f23680
commit
e406bdbb80
@ -24,8 +24,7 @@
|
|||||||
#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 <string>
|
#include <string>
|
||||||
@ -36,7 +35,7 @@
|
|||||||
* Its methods must be thread-safe.
|
* Its methods must be thread-safe.
|
||||||
*/
|
*/
|
||||||
class TidalSessionHandler
|
class TidalSessionHandler
|
||||||
: public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::safe_link>>
|
: public SafeLinkIntrusiveListHook
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -84,8 +83,7 @@ class TidalSessionManager final : TidalLoginHandler {
|
|||||||
*/
|
*/
|
||||||
std::string session;
|
std::string session;
|
||||||
|
|
||||||
typedef boost::intrusive::list<TidalSessionHandler,
|
using LoginHandlerList = IntrusiveList<TidalSessionHandler>;
|
||||||
boost::intrusive::constant_time_size<false>> LoginHandlerList;
|
|
||||||
|
|
||||||
LoginHandlerList handlers;
|
LoginHandlerList handlers;
|
||||||
|
|
||||||
@ -123,7 +121,7 @@ public:
|
|||||||
void RemoveLoginHandler(TidalSessionHandler &h) noexcept {
|
void RemoveLoginHandler(TidalSessionHandler &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();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GetToken() const noexcept {
|
const char *GetToken() const noexcept {
|
||||||
|
Loading…
Reference in New Issue
Block a user