From 4b4aca9f84028a86d1e434fd0d4fcfbf2b837836 Mon Sep 17 00:00:00 2001 From: Dominik Drexler Date: Tue, 21 Nov 2023 18:04:41 +0100 Subject: [PATCH] removed mutexes from factory since we do not need them --- include/dlplan/utils/factory.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/dlplan/utils/factory.h b/include/dlplan/utils/factory.h index c7f2d545..114cd933 100644 --- a/include/dlplan/utils/factory.h +++ b/include/dlplan/utils/factory.h @@ -13,7 +13,6 @@ namespace dlplan { template struct PerTypeCache { std::unordered_map> data; - std::mutex mutex; }; template @@ -23,7 +22,7 @@ struct GetOrCreateResult { }; -/// @brief A thread-safe reference-counted object cache. +/// @brief A reference-counted object cache. /// Original idea by Herb Sutter. /// Custom deleter idea: https://stackoverflow.com/questions/49782011/herb-sutters-10-liner-with-cleanup template @@ -54,7 +53,7 @@ class ReferenceCountedObjectFactory { std::shared_ptr sp; auto& cached = t_cache->data[*element]; sp = cached.lock(); - std::lock_guard hold(t_cache->mutex); + // std::lock_guard hold(t_cache->mutex); bool new_insertion = false; if (!sp) { @@ -64,7 +63,7 @@ class ReferenceCountedObjectFactory { [parent=t_cache, original_deleter=element.get_deleter()](T* x) { { - std::lock_guard hold(parent->mutex); + // std::lock_guard hold(parent->mutex); parent->data.erase(*x); } /* After cache removal, we can call the objects destructor