summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-10-01 12:34:56 -0400
committerDavid Robillard <d@drobilla.net>2016-10-02 12:24:57 -0400
commit5c4356827e51b3d6e1256a050e6273a87728d588 (patch)
treedf5a907daa250fdeb94401a133468fc42ac35766
parentf5826c37b4c02c2b07ea4a863fbf0446d4eb9f05 (diff)
downloadingen-5c4356827e51b3d6e1256a050e6273a87728d588.tar.gz
ingen-5c4356827e51b3d6e1256a050e6273a87728d588.tar.bz2
ingen-5c4356827e51b3d6e1256a050e6273a87728d588.zip
Use more efficient std::lock_guard where possible
-rw-r--r--src/server/events/Connect.cpp2
-rw-r--r--src/server/events/Copy.cpp2
-rw-r--r--src/server/events/Delete.cpp2
-rw-r--r--src/server/events/Disconnect.cpp2
-rw-r--r--src/server/events/Get.cpp2
-rw-r--r--src/server/events/Move.cpp2
6 files changed, 6 insertions, 6 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index 57bfb975..17fa640f 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -51,7 +51,7 @@ Connect::Connect(Engine& engine,
bool
Connect::pre_process()
{
- std::unique_lock<std::mutex> lock(_engine.store()->mutex());
+ std::lock_guard<std::mutex> lock(_engine.store()->mutex());
Node* tail = _engine.store()->get(_tail_path);
if (!tail) {
diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp
index 04c77316..8959e4e1 100644
--- a/src/server/events/Copy.cpp
+++ b/src/server/events/Copy.cpp
@@ -50,7 +50,7 @@ Copy::Copy(Engine& engine,
bool
Copy::pre_process()
{
- std::unique_lock<std::mutex> lock(_engine.store()->mutex());
+ std::lock_guard<std::mutex> lock(_engine.store()->mutex());
if (Node::uri_is_path(_old_uri)) {
// Old URI is a path within the engine
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index 12c9a3f1..0d202f84 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -84,7 +84,7 @@ Delete::pre_process()
}
// Take a writer lock while we modify the store
- std::unique_lock<std::mutex> lock(_engine.store()->mutex());
+ std::lock_guard<std::mutex> lock(_engine.store()->mutex());
_engine.store()->remove(iter, _removed_objects);
diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp
index 9d1b18a3..ed9312d5 100644
--- a/src/server/events/Disconnect.cpp
+++ b/src/server/events/Disconnect.cpp
@@ -114,7 +114,7 @@ Disconnect::Impl::Impl(Engine& e,
bool
Disconnect::pre_process()
{
- std::unique_lock<std::mutex> lock(_engine.store()->mutex());
+ std::lock_guard<std::mutex> lock(_engine.store()->mutex());
if (_tail_path.parent().parent() != _head_path.parent().parent()
&& _tail_path.parent() != _head_path.parent().parent()
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index bec57104..b018c1a9 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -48,7 +48,7 @@ Get::Get(Engine& engine,
bool
Get::pre_process()
{
- std::unique_lock<std::mutex> lock(_engine.store()->mutex());
+ std::lock_guard<std::mutex> lock(_engine.store()->mutex());
if (_uri == "ingen:/plugins") {
_plugins = _engine.block_factory()->plugins();
diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp
index b30c2ec2..d6eae6d6 100644
--- a/src/server/events/Move.cpp
+++ b/src/server/events/Move.cpp
@@ -48,7 +48,7 @@ Move::~Move()
bool
Move::pre_process()
{
- std::unique_lock<std::mutex> lock(_engine.store()->mutex());
+ std::lock_guard<std::mutex> lock(_engine.store()->mutex());
if (!_old_path.parent().is_parent_of(_new_path)) {
return Event::pre_process_done(Status::PARENT_DIFFERS, _new_path);