summaryrefslogtreecommitdiff
path: root/collect
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2022-02-03 14:04:07 -0800
committerScott Gasch <[email protected]>2022-02-03 14:04:07 -0800
commiteb1c6392095947b3205c4d52cd9b1507e6cd776b (patch)
tree4f22adda3a09712fcb1d0b527d2af42a4e5eff5d /collect
parentffed473528c4feb836253758e86f7839af98f57b (diff)
Take the lock before unlinking the mmap'ed shared memory to ensure
all writes are finished and visible.
Diffstat (limited to 'collect')
-rw-r--r--collect/shared_dict.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/collect/shared_dict.py b/collect/shared_dict.py
index ac390bc..ec76138 100644
--- a/collect/shared_dict.py
+++ b/collect/shared_dict.py
@@ -108,7 +108,8 @@ class SharedDict(object):
def cleanup(self) -> None:
if not hasattr(self, 'shared_memory'):
return
- self.shared_memory.unlink()
+ with SharedDict.MPLOCK:
+ self.shared_memory.unlink()
def clear(self) -> None:
self._save_memory({})