ramfs: Add iterator locking to index classes.

This commit is contained in:
Augustin Cavalier 2025-01-16 23:23:39 -05:00
parent 5ac03c3714
commit ebc6bc8ed7
3 changed files with 15 additions and 0 deletions

View File

@ -17,6 +17,9 @@
#include "TwoKeyAVLTree.h"
#include "Volume.h"
#include <util/AutoLock.h>
// compare_integral
template<typename Key>
static inline
@ -341,6 +344,7 @@ AttributeIndexImpl::InternalFind(const uint8 *key, size_t length)
void
AttributeIndexImpl::_AddIterator(Iterator *iterator)
{
RecursiveLocker locker(fVolume->GetAttributeIteratorLock());
fIterators->Insert(iterator);
}
@ -348,6 +352,7 @@ AttributeIndexImpl::_AddIterator(Iterator *iterator)
void
AttributeIndexImpl::_RemoveIterator(Iterator *iterator)
{
RecursiveLocker locker(fVolume->GetAttributeIteratorLock());
fIterators->Remove(iterator);
}

View File

@ -14,6 +14,9 @@
#include "NodeListener.h"
#include "Volume.h"
#include <util/AutoLock.h>
// LastModifiedIndexPrimaryKey
class LastModifiedIndexPrimaryKey {
public:
@ -226,6 +229,7 @@ LastModifiedIndex::InternalFind(const uint8 *key, size_t length)
void
LastModifiedIndex::_AddIterator(Iterator *iterator)
{
RecursiveLocker locker(fVolume->GetAttributeIteratorLock());
fIterators->Insert(iterator);
}
@ -233,6 +237,7 @@ LastModifiedIndex::_AddIterator(Iterator *iterator)
void
LastModifiedIndex::_RemoveIterator(Iterator *iterator)
{
RecursiveLocker locker(fVolume->GetAttributeIteratorLock());
fIterators->Remove(iterator);
}

View File

@ -13,6 +13,9 @@
#include "SizeIndex.h"
#include "Volume.h"
#include <util/AutoLock.h>
// SizeIndexPrimaryKey
class SizeIndexPrimaryKey {
public:
@ -225,6 +228,7 @@ SizeIndex::InternalFind(const uint8 *key, size_t length)
void
SizeIndex::_AddIterator(Iterator *iterator)
{
RecursiveLocker locker(fVolume->GetAttributeIteratorLock());
fIterators->Insert(iterator);
}
@ -232,6 +236,7 @@ SizeIndex::_AddIterator(Iterator *iterator)
void
SizeIndex::_RemoveIterator(Iterator *iterator)
{
RecursiveLocker locker(fVolume->GetAttributeIteratorLock());
fIterators->Remove(iterator);
}