summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/Connect.cpp34
-rw-r--r--src/server/events/Delete.cpp8
-rw-r--r--src/server/events/Delete.hpp2
-rw-r--r--src/server/events/Delta.cpp15
-rw-r--r--src/server/events/Delta.hpp2
-rw-r--r--src/server/events/Disconnect.cpp4
-rw-r--r--src/server/events/DisconnectAll.cpp5
-rw-r--r--src/server/events/Get.cpp4
-rw-r--r--src/server/events/Move.cpp4
9 files changed, 32 insertions, 46 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index 13faabd4..1b11702f 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -14,8 +14,6 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <glibmm/thread.h>
-
#include "ingen/Store.hpp"
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
@@ -52,7 +50,7 @@ Connect::Connect(Engine& engine,
bool
Connect::pre_process()
{
- Glib::RWLock::ReaderLock rlock(_engine.store()->lock());
+ std::unique_lock<std::mutex> lock(_engine.store()->mutex());
Node* tail = _engine.store()->get(_tail_path);
if (!tail) {
@@ -108,26 +106,22 @@ Connect::pre_process()
_arc = SPtr<ArcImpl>(new ArcImpl(tail_output, _head));
- rlock.release();
+ /* Need to be careful about graph port arcs here and adding a
+ block's parent as a dependant/provider, or adding a graph as its own
+ provider...
+ */
+ if (tail_block != head_block && tail_block->parent() == head_block->parent()) {
+ head_block->providers().push_back(tail_block);
+ tail_block->dependants().push_back(head_block);
+ }
- {
- Glib::RWLock::ReaderLock wlock(_engine.store()->lock());
+ _graph->add_arc(_arc);
+ _head->increment_num_arcs();
- /* Need to be careful about graph port arcs here and adding a
- block's parent as a dependant/provider, or adding a graph as its own
- provider...
- */
- if (tail_block != head_block && tail_block->parent() == head_block->parent()) {
- head_block->providers().push_back(tail_block);
- tail_block->dependants().push_back(head_block);
- }
+ tail_output->inherit_neighbour(_head, _tail_remove, _tail_add);
+ _head->inherit_neighbour(tail_output, _head_remove, _head_add);
- _graph->add_arc(_arc);
- _head->increment_num_arcs();
-
- tail_output->inherit_neighbour(_head, _tail_remove, _tail_add);
- _head->inherit_neighbour(tail_output, _head_remove, _head_add);
- }
+ lock.unlock();
_voices = new Raul::Array<PortImpl::Voice>(_head->poly());
_head->get_buffers(*_engine.buffer_factory(),
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index 993530a8..2d324515 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -45,7 +45,7 @@ Delete::Delete(Engine& engine,
, _ports_array(NULL)
, _compiled_graph(NULL)
, _disconnect_event(NULL)
- , _lock(engine.store()->lock(), Glib::NOT_LOCK)
+ , _lock(engine.store()->mutex(), std::defer_lock)
{
if (Node::uri_is_path(uri)) {
_path = Node::uri_to_path(uri);
@@ -84,7 +84,7 @@ Delete::pre_process()
return Event::pre_process_done(Status::INTERNAL_ERROR, _path);
}
- _lock.acquire();
+ _lock.lock();
_engine.store()->remove(iter, _removed_objects);
@@ -145,8 +145,8 @@ Delete::execute(ProcessContext& context)
void
Delete::post_process()
{
- if (_lock.locked()) {
- _lock.release();
+ if (_lock.owns_lock()) {
+ _lock.unlock();
}
_removed_bindings.reset();
diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp
index 3cf9a2dc..dc695ab8 100644
--- a/src/server/events/Delete.hpp
+++ b/src/server/events/Delete.hpp
@@ -82,7 +82,7 @@ private:
SPtr<ControlBindings::Bindings> _removed_bindings;
Store::Objects _removed_objects;
- Glib::RWLock::WriterLock _lock;
+ std::unique_lock<std::mutex> _lock;
};
} // namespace Events
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index f1acbdc2..23285b9b 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -15,8 +15,7 @@
*/
#include <vector>
-
-#include <glibmm/thread.h>
+#include <thread>
#include "ingen/Store.hpp"
#include "ingen/URIs.hpp"
@@ -63,7 +62,7 @@ Delta::Delta(Engine& engine,
, _compiled_graph(NULL)
, _context(context)
, _type(type)
- , _poly_lock(engine.store()->lock(), Glib::NOT_LOCK)
+ , _poly_lock(engine.store()->mutex(), std::defer_lock)
{
if (context != Resource::Graph::DEFAULT) {
for (auto& p : _properties) {
@@ -107,7 +106,7 @@ Delta::pre_process()
bool poly_changed = false;
// Take a writer lock while we modify the store
- Glib::RWLock::WriterLock lock(_engine.store()->lock());
+ std::unique_lock<std::mutex> lock(_engine.store()->mutex());
_object = is_graph_object
? static_cast<Ingen::Resource*>(_engine.store()->get(Node::uri_to_path(_subject)))
@@ -279,8 +278,8 @@ Delta::pre_process()
}
if (poly_changed) {
- lock.release();
- _poly_lock.acquire();
+ lock.unlock();
+ _poly_lock.lock();
}
return Event::pre_process_done(
@@ -377,8 +376,8 @@ Delta::execute(ProcessContext& context)
void
Delta::post_process()
{
- if (_poly_lock.locked()) {
- _poly_lock.release();
+ if (_poly_lock.owns_lock()) {
+ _poly_lock.unlock();
}
Broadcaster::Transfer t(*_engine.broadcaster());
diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp
index a8e8ed0b..45de197e 100644
--- a/src/server/events/Delta.hpp
+++ b/src/server/events/Delta.hpp
@@ -119,7 +119,7 @@ private:
SPtr<ControlBindings::Bindings> _old_bindings;
- Glib::RWLock::WriterLock _poly_lock; ///< Long-term lock for poly changes
+ std::unique_lock<std::mutex> _poly_lock; ///< Long-term lock for poly changes
};
} // namespace Events
diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp
index e0931f59..39b5da00 100644
--- a/src/server/events/Disconnect.cpp
+++ b/src/server/events/Disconnect.cpp
@@ -16,8 +16,6 @@
#include <list>
-#include <glibmm/thread.h>
-
#include "ingen/Store.hpp"
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
@@ -111,7 +109,7 @@ Disconnect::Impl::Impl(Engine& e,
bool
Disconnect::pre_process()
{
- Glib::RWLock::WriterLock lock(_engine.store()->lock());
+ std::unique_lock<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/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp
index ef876ffe..22560c7e 100644
--- a/src/server/events/DisconnectAll.cpp
+++ b/src/server/events/DisconnectAll.cpp
@@ -17,7 +17,6 @@
#include <set>
#include <boost/format.hpp>
-#include <glibmm/thread.h>
#include "ingen/Store.hpp"
#include "raul/Array.hpp"
@@ -82,10 +81,10 @@ DisconnectAll::~DisconnectAll()
bool
DisconnectAll::pre_process()
{
- Glib::RWLock::WriterLock lock(_engine.store()->lock(), Glib::NOT_LOCK);
+ std::unique_lock<std::mutex> lock(_engine.store()->mutex(), std::defer_lock);
if (!_deleting) {
- lock.acquire();
+ lock.lock();
_parent = dynamic_cast<GraphImpl*>(_engine.store()->get(_parent_path));
if (!_parent) {
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index 6269aa2a..c984e576 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -16,8 +16,6 @@
#include <utility>
-#include <glibmm/thread.h>
-
#include "ingen/Interface.hpp"
#include "ingen/Node.hpp"
#include "ingen/Store.hpp"
@@ -116,7 +114,7 @@ Get::Get(Engine& engine,
bool
Get::pre_process()
{
- Glib::RWLock::ReaderLock lock(_engine.store()->lock());
+ std::unique_lock<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 44939525..9da77bc8 100644
--- a/src/server/events/Move.cpp
+++ b/src/server/events/Move.cpp
@@ -14,8 +14,6 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <glibmm/thread.h>
-
#include "ingen/Store.hpp"
#include "raul/Path.hpp"
@@ -50,7 +48,7 @@ Move::~Move()
bool
Move::pre_process()
{
- Glib::RWLock::WriterLock lock(_engine.store()->lock());
+ std::unique_lock<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);