diff options
author | David Robillard <d@drobilla.net> | 2015-10-23 19:41:17 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-10-23 19:41:17 +0000 |
commit | 707c59c87c2c0c954b6da584c6799780de600004 (patch) | |
tree | 983a30bd55dae9b3b7b80de7746e9335b6117ce2 /src | |
parent | 626ec62aab67c136c405cc88213d7b92325c01d7 (diff) | |
download | ingen-707c59c87c2c0c954b6da584c6799780de600004.tar.gz ingen-707c59c87c2c0c954b6da584c6799780de600004.tar.bz2 ingen-707c59c87c2c0c954b6da584c6799780de600004.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/server/events/Delete.cpp | 8 | ||||
-rw-r--r-- | src/server/events/Delete.hpp | 2 |
2 files changed, 2 insertions, 8 deletions
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<std::mutex> 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<ControlBindings::Bindings> _removed_bindings; Store::Objects _removed_objects; - - std::unique_lock<std::mutex> _lock; }; } // namespace Events |