Skip to content

Commit 2a17735

Browse files
committed
FIX: objcachev2 should not use spinlock for create or erase
1 parent 7c7d10e commit 2a17735

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

common/objectcachev2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ObjectCacheV2 {
3838
const K key;
3939
std::shared_ptr<V> ref;
4040
// prevent create multiple time when borrow
41-
photon::spinlock createlock;
41+
photon::mutex createlock{0};
4242
// create timestamp, for cool-down of borrow
4343
uint64_t lastcreate = 0;
4444
// reclaim timestamp
@@ -83,7 +83,7 @@ class ObjectCacheV2 {
8383
};
8484

8585
// protect object cache map
86-
photon::spinlock maplock;
86+
photon::mutex maplock{0};
8787
// protect lru list
8888
std::unordered_set<Box, BoxHash, BoxEqual> map;
8989
intrusive_list<Box> lru_list;

0 commit comments

Comments
 (0)