Use shared_mutex for ReadDir state

- Replace atomic shared pointer loads/stores with shared/unique locking.
- Store the configured readdir mode directly as std::string.
- Copy the active ReadDir implementation under lock before invoking it.
This commit is contained in:
Antonio SJ Musumeci 2026-05-13 17:41:36 -05:00
parent e9301e7969
commit e48cbe2185
2 changed files with 25 additions and 18 deletions

View file

@ -22,9 +22,9 @@
#include "tofrom_string.hpp"
#include "fuse_readdir_base.hpp"
#include <atomic>
#include <memory>
#include <mutex>
#include <shared_mutex>
namespace FUSE
@ -59,8 +59,9 @@ namespace FUSE
void initialize();
private:
std::atomic<bool> _initialized = false;
std::shared_ptr<std::string> _str;
bool _initialized = false;
mutable std::shared_mutex _mutex;
std::string _str;
std::shared_ptr<FUSE::ReadDirBase> _impl;
};
}