input/cache: use IntrusiveList instead of boost::intrusive::list

This commit is contained in:
Max Kellermann 2022-11-10 12:03:41 +01:00
parent 89d950e9a7
commit 77d257de27
3 changed files with 7 additions and 13 deletions

View File

@ -22,8 +22,8 @@
#include "input/BufferingInputStream.hxx" #include "input/BufferingInputStream.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/IntrusiveList.hxx"
#include <boost/intrusive/list.hpp>
#include <boost/intrusive/set_hook.hpp> #include <boost/intrusive/set_hook.hpp>
#include <string> #include <string>
@ -39,15 +39,12 @@ class InputCacheLease;
*/ */
class InputCacheItem final class InputCacheItem final
: public BufferingInputStream, : public BufferingInputStream,
public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::auto_unlink>>, public AutoUnlinkIntrusiveListHook,
public boost::intrusive::set_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> public boost::intrusive::set_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>>
{ {
const std::string uri; const std::string uri;
using LeaseList = using LeaseList = IntrusiveList<InputCacheLease>;
boost::intrusive::list<InputCacheLease,
boost::intrusive::base_hook<boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>>>,
boost::intrusive::constant_time_size<false>>;
LeaseList leases; LeaseList leases;
LeaseList::iterator next_lease = leases.end(); LeaseList::iterator next_lease = leases.end();

View File

@ -21,8 +21,7 @@
#define MPD_INPUT_CACHE_LEASE_HXX #define MPD_INPUT_CACHE_LEASE_HXX
#include "Item.hxx" #include "Item.hxx"
#include "util/IntrusiveList.hxx"
#include <boost/intrusive/list_hook.hpp>
#include <utility> #include <utility>
@ -30,7 +29,7 @@
* A lease for an #InputCacheItem. * A lease for an #InputCacheItem.
*/ */
class InputCacheLease class InputCacheLease
: public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> : public IntrusiveListHook
{ {
InputCacheItem *item = nullptr; InputCacheItem *item = nullptr;

View File

@ -21,9 +21,9 @@
#define MPD_INPUT_CACHE_MANAGER_HXX #define MPD_INPUT_CACHE_MANAGER_HXX
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/IntrusiveList.hxx"
#include <boost/intrusive/set.hpp> #include <boost/intrusive/set.hpp>
#include <boost/intrusive/list.hpp>
class InputStream; class InputStream;
class InputCacheItem; class InputCacheItem;
@ -55,9 +55,7 @@ class InputCacheManager {
const InputCacheItem &b) const noexcept; const InputCacheItem &b) const noexcept;
}; };
boost::intrusive::list<InputCacheItem, IntrusiveList<InputCacheItem> items_by_time;
boost::intrusive::base_hook<boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::auto_unlink>>>,
boost::intrusive::constant_time_size<false>> items_by_time;
using UriMap = using UriMap =
boost::intrusive::set<InputCacheItem, boost::intrusive::set<InputCacheItem,