mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 06:32:09 +00:00
Add back mutex
This commit is contained in:
@@ -361,6 +361,8 @@ ifcopenshell::impl::rocks_db_file_storage::rocksdb_types_iterator::value_type co
|
|||||||
|
|
||||||
express::Base ifcopenshell::impl::rocks_db_file_storage::assert_existance(size_t number, instance_ref r) {
|
express::Base ifcopenshell::impl::rocks_db_file_storage::assert_existance(size_t number, instance_ref r) {
|
||||||
#ifdef IFOPSH_WITH_ROCKSDB
|
#ifdef IFOPSH_WITH_ROCKSDB
|
||||||
|
std::lock_guard<std::mutex> lock(instance_cache_mutex_);
|
||||||
|
|
||||||
if (r == ifcopenshell::impl::rocks_db_file_storage::entityinstance_ref) {
|
if (r == ifcopenshell::impl::rocks_db_file_storage::entityinstance_ref) {
|
||||||
auto it = instance_cache_.find(number);
|
auto it = instance_cache_.find(number);
|
||||||
if (it != instance_cache_.end()) {
|
if (it != instance_cache_.end()) {
|
||||||
|
|||||||
@@ -2872,6 +2872,7 @@ void ifcopenshell::file::unbatch() {
|
|||||||
void ifcopenshell::file::reset_identity_cache() {
|
void ifcopenshell::file::reset_identity_cache() {
|
||||||
std::visit([](auto& x) {
|
std::visit([](auto& x) {
|
||||||
if constexpr (std::is_same_v<std::decay_t<decltype(x)>, impl::rocks_db_file_storage>) {
|
if constexpr (std::is_same_v<std::decay_t<decltype(x)>, impl::rocks_db_file_storage>) {
|
||||||
|
std::lock_guard<std::mutex> lock(x.instance_cache_mutex_);
|
||||||
x.instance_cache_.clear();
|
x.instance_cache_.clear();
|
||||||
x.type_instance_cache_.clear();
|
x.type_instance_cache_.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace rocksdb {
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <mutex>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
@@ -354,6 +355,7 @@ namespace ifcopenshell {
|
|||||||
// @todo this is silly, but we cannot have the same type, this should be just a pointer then on the file side?
|
// @todo this is silly, but we cannot have the same type, this should be just a pointer then on the file side?
|
||||||
typedef std::map<uint32_t, std::shared_ptr<instance_data>> entity_by_iden_cache_t;
|
typedef std::map<uint32_t, std::shared_ptr<instance_data>> entity_by_iden_cache_t;
|
||||||
entity_by_iden_cache_t instance_cache_, type_instance_cache_;
|
entity_by_iden_cache_t instance_cache_, type_instance_cache_;
|
||||||
|
std::mutex instance_cache_mutex_;
|
||||||
|
|
||||||
// @todo all these size_ts should probably be uint32_t for consistency with in-mem storage
|
// @todo all these size_ts should probably be uint32_t for consistency with in-mem storage
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user