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 "thread/Mutex.hxx"
#include "util/IntrusiveList.hxx"
#include <boost/intrusive/list.hpp>
#include <boost/intrusive/set_hook.hpp>
#include <string>
@ -39,15 +39,12 @@ class InputCacheLease;
*/
class InputCacheItem final
: 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>>
{
const std::string uri;
using LeaseList =
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>>;
using LeaseList = IntrusiveList<InputCacheLease>;
LeaseList leases;
LeaseList::iterator next_lease = leases.end();

View File

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

View File

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