mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
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:
parent
aa46001923
commit
103cd358f2
1 changed files with 9 additions and 1 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue