input/qobuz: use class IntrusiveList
This commit is contained in:
		| @@ -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(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann