diff options
author | David Robillard <d@drobilla.net> | 2011-09-24 03:22:30 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-09-24 03:22:30 +0000 |
commit | 74a711e0d1cdb5c505a227dc9b1925657f1e778d (patch) | |
tree | 78f93b26e4154c76892cb0160414c4effbfc730e /src/server/events/CreatePort.cpp | |
parent | 2be10b0b6f2c0f01870208e9d18e5db87e5dfb88 (diff) | |
download | ingen-74a711e0d1cdb5c505a227dc9b1925657f1e778d.tar.gz ingen-74a711e0d1cdb5c505a227dc9b1925657f1e778d.tar.bz2 ingen-74a711e0d1cdb5c505a227dc9b1925657f1e778d.zip |
Use store lock to avoid race conditions with Get and create/delete events.
Get really shouldn't be reading the store (via ObjectSender) in the post
processing thread at all, avoiding that entirely would be a better solution.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3484 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events/CreatePort.cpp')
-rw-r--r-- | src/server/events/CreatePort.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 4541892b..fdf675a6 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -58,6 +58,7 @@ CreatePort::CreatePort( , _patch_port(NULL) , _driver_port(NULL) , _properties(properties) + , _lock(engine.engine_store()->lock(), Glib::NOT_LOCK) { /* This is blocking because of the two different sets of Patch ports, the array used in the * audio thread (inherited from NodeImpl), and the arrays used in the pre processor thread. @@ -74,6 +75,8 @@ CreatePort::CreatePort( void CreatePort::pre_process() { + _lock.acquire(); + if (_error == UNKNOWN_TYPE || _engine.engine_store()->find_object(_path)) { QueuedEvent::pre_process(); return; @@ -161,8 +164,10 @@ CreatePort::execute(ProcessContext& context) void CreatePort::post_process() { - if (!_request) + if (!_request) { + _lock.release(); return; + } string msg; switch (_error) { @@ -183,6 +188,8 @@ CreatePort::post_process() _request->respond_error(msg); break; } + + _lock.release(); } } // namespace Server |