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