From 707c59c87c2c0c954b6da584c6799780de600004 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 23 Oct 2015 19:41:17 +0000 Subject: Speed up multi-deletion Take only a fine-grained lock on the store for deletion. IIRC, the long lock was to avoid conflict with Get which accesses the store in post_process(), but this issue has been fixed and events only access the store in pre_process(). I believe it is now safe to only lock Delete during pre_process() as a result. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5771 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/events/Delete.cpp | 8 ++------ src/server/events/Delete.hpp | 2 -- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src/server/events') diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index 54b6ace2..06a5cb95 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -45,7 +45,6 @@ Delete::Delete(Engine& engine, , _ports_array(NULL) , _compiled_graph(NULL) , _disconnect_event(NULL) - , _lock(engine.store()->mutex(), std::defer_lock) { if (Node::uri_is_path(uri)) { _path = Node::uri_to_path(uri); @@ -84,7 +83,8 @@ Delete::pre_process() return Event::pre_process_done(Status::INTERNAL_ERROR, _path); } - _lock.lock(); + // Take a writer lock while we modify the store + std::unique_lock lock(_engine.store()->mutex()); _engine.store()->remove(iter, _removed_objects); @@ -145,10 +145,6 @@ Delete::execute(ProcessContext& context) void Delete::post_process() { - if (_lock.owns_lock()) { - _lock.unlock(); - } - _removed_bindings.reset(); Broadcaster::Transfer t(*_engine.broadcaster()); diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index 9711ce16..30a53b12 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -81,8 +81,6 @@ private: SPtr _removed_bindings; Store::Objects _removed_objects; - - std::unique_lock _lock; }; } // namespace Events -- cgit v1.2.1