summaryrefslogtreecommitdiffstats
path: root/src/client/ThreadedSigClientInterface.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-10 03:23:11 +0000
committerDavid Robillard <d@drobilla.net>2012-05-10 03:23:11 +0000
commitda468f24388d7f0f574c6e4dd4022e05d47a9db2 (patch)
tree32e90d5fa55a35caef43cb69592286fc31c5d4f4 /src/client/ThreadedSigClientInterface.cpp
parent281bbcc6a7208c28283bc9bdd521c5d6cc48a60f (diff)
downloadingen-da468f24388d7f0f574c6e4dd4022e05d47a9db2.tar.gz
ingen-da468f24388d7f0f574c6e4dd4022e05d47a9db2.tar.bz2
ingen-da468f24388d7f0f574c6e4dd4022e05d47a9db2.zip
Use SharedPtr references to Interfaces to keep things sane.
Fix double register when using GUI with a remote engine. Avoid signal when writing to dead socket by using send with MSG_NOSIGNAL. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4336 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client/ThreadedSigClientInterface.cpp')
-rw-r--r--src/client/ThreadedSigClientInterface.cpp74
1 files changed, 0 insertions, 74 deletions
diff --git a/src/client/ThreadedSigClientInterface.cpp b/src/client/ThreadedSigClientInterface.cpp
deleted file mode 100644
index 2679724c..00000000
--- a/src/client/ThreadedSigClientInterface.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "raul/log.hpp"
-#include "ingen/Patch.hpp"
-#include "ingen/Plugin.hpp"
-#include "ingen/Port.hpp"
-#include "ingen/client/ThreadedSigClientInterface.hpp"
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-namespace Client {
-
-/** Push an event (from the engine, ie 'new patch') on to the queue.
- */
-void
-ThreadedSigClientInterface::push_sig(Closure ev)
-{
- bool success = false;
- while (!success) {
- success = _sigs.push(ev);
- if (!success) {
- warn << "Client event queue full. Waiting..." << endl;
- _mutex.lock();
- _cond.wait(_mutex);
- _mutex.unlock();
- warn << "Queue drained, continuing" << endl;
- }
- }
-}
-
-/** Process all queued events that came from the OSC thread.
- *
- * This function should be called from the Gtk thread to emit signals and cause
- * the connected methods to execute.
- */
-bool
-ThreadedSigClientInterface::emit_signals()
-{
- // Process a limited number of events, to prevent locking the GTK
- // thread indefinitely while processing continually arriving events
-
- size_t num_processed = 0;
- while (!_sigs.empty() && num_processed++ < (_sigs.capacity() * 3 / 4)) {
- Closure& ev = _sigs.front();
- ev();
- ev.disconnect();
- _sigs.pop();
- }
-
- _mutex.lock();
- _cond.broadcast();
- _mutex.unlock();
-
- return true;
-}
-
-} // namespace Client
-} // namespace Ingen