#include <memory>
#endif
#include "common/ceph_mutex.h"
+#include "common/ceph_context.h"
#include "common/dout.h"
#include "include/unordered_map.h"
-// re-include our assert to clobber the system one; fix dout:
-#include "include/ceph_assert.h"
-
template <class K, class V>
class SharedLRU {
CephContext *cct;
VPtr val; // release any ref we have after we drop the lock
{
std::lock_guard l{lock};
- typename map<K, pair<WeakVPtr, V*>, C>::iterator i = weak_refs.find(key);
+ auto i = weak_refs.find(key);
if (i != weak_refs.end()) {
val = i->second.first.lock();
}
void clear_range(
const K& from,
const K& to) {
- list<VPtr> vals; // release any refs we have after we drop the lock
+ std::list<VPtr> vals; // release any refs we have after we drop the lock
{
std::lock_guard l{lock};
auto from_iter = weak_refs.lower_bound(from);
VPtr val; // release any ref we have after we drop the lock
{
std::lock_guard l{lock};
- typename map<K, pair<WeakVPtr, V*>, C>::iterator i = weak_refs.find(key);
+ auto i = weak_refs.find(key);
if (i != weak_refs.end()) {
val = i->second.first.lock();
weak_refs.erase(i);
}
void set_size(size_t new_size) {
- list<VPtr> to_release;
+ std::list<VPtr> to_release;
{
std::lock_guard l{lock};
max_size = new_size;
VPtr lower_bound(const K& key) {
VPtr val;
- list<VPtr> to_release;
+ std::list<VPtr> to_release;
{
std::unique_lock l{lock};
++waiting;
}
VPtr lookup_or_create(const K &key) {
VPtr val;
- list<VPtr> to_release;
+ std::list<VPtr> to_release;
{
std::unique_lock l{lock};
cond.wait(l, [this, &key, &val] {
*/
VPtr add(const K& key, V *value, bool *existed = NULL) {
VPtr val;
- list<VPtr> to_release;
+ std::list<VPtr> to_release;
{
- typename map<K, pair<WeakVPtr, V*>, C>::iterator actual;
+ typename std::map<K, std::pair<WeakVPtr, V*>, C>::iterator actual;
std::unique_lock l{lock};
cond.wait(l, [this, &key, &actual, &val] {
actual = weak_refs.lower_bound(key);