From faa4b0c6f8d959a227a397cf63dacd1171efd61c Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Wed, 30 Sep 2015 13:17:35 +0200 Subject: [PATCH] Improve flush() --- implementations/onblocks/datatreestore/DataTree.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/implementations/onblocks/datatreestore/DataTree.cpp b/implementations/onblocks/datatreestore/DataTree.cpp index 9d913371..e1e8ca94 100644 --- a/implementations/onblocks/datatreestore/DataTree.cpp +++ b/implementations/onblocks/datatreestore/DataTree.cpp @@ -126,6 +126,9 @@ const Key &DataTree::key() const { } void DataTree::flush() const { + // By grabbing a lock, we ensure that all modifying functions don't run currently and are therefore flushed + unique_lock lock(_mutex); + // We also have to flush the root node _rootNode->flush(); }