Add lock_guard VineMap::for_each 54/265554/2
authorcheoleun moon <chleun.moon@samsung.com>
Fri, 22 Oct 2021 02:22:48 +0000 (11:22 +0900)
committercheoleun moon <chleun.moon@samsung.com>
Fri, 22 Oct 2021 06:34:57 +0000 (06:34 +0000)
Change-Id: I72ba4c67ae61c1644668bdb4eaa7da1d146a81d5

src/include/vine-map.h

index 6b06157..cccaadc 100755 (executable)
@@ -69,6 +69,7 @@ public:
        // The protyotype of do_func(): void func(K &k, V & v)
        template <class BinaryPredicate> void for_each(BinaryPredicate do_func)
        {
+               std::lock_guard<std::mutex> lock_guard(_q_mutex);
                for (auto it = _map.begin(); it != _map.end(); ++it)
                        do_func(it->first, it->second);
        }