summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netfs/fuse/fuseFiles.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp
index eb80531..8aed188 100644
--- a/netfs/fuse/fuseFiles.cpp
+++ b/netfs/fuse/fuseFiles.cpp
@@ -30,12 +30,12 @@ FuseApp::OpenFile::wait() const
void
FuseApp::OpenFile::flush()
{
- Lock(_lock);
- while (!bg.empty()) {
- auto wi = bg.begin();
- auto w = wi->second;
- bg.erase(w);
- // bg operations are void, so no need to actually get the return value
+ auto first = [this]() {
+ SharedLock(_lock);
+ return bg.empty() ? nullptr : bg.begin()->second;
+ };
+ while (auto w = first()) {
+ // background operations are void, so no need to actually get the return value
w->throwLocalException();
}
}