state: atomic ref_count in OpenFile

ref_count is read and written from multiple FUSE worker threads
during open/release. Make it std::atomic<int> and provide a move
constructor so OpenFile remains movable when the underlying atomic
is non-movable.
This commit is contained in:
Antonio S. Musumeci 2026-04-18 00:45:23 -04:00 • committed by trapexit
parent aa46001923
commit 103cd358f2

View file

@ -79,6 +79,7 @@
#include "fuse.h"
#include <atomic>
#include <functional>
#include <map>
#include <string>
@ -102,7 +103,14 @@ public:
{
}
int ref_count;
OpenFile(OpenFile &&o_) noexcept
: ref_count(o_.ref_count.load()),
backing_id(o_.backing_id),
fi(o_.fi)
{
}
std::atomic<int> ref_count;
int backing_id;
FileInfo *fi;
};