diff options
author | David Robillard <d@drobilla.net> | 2007-01-22 04:07:53 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-01-22 04:07:53 +0000 |
commit | 6fc1fa0d3bec4b82cb3af4c4e887241087899e7e (patch) | |
tree | 642326c791c1cac6390b8cc10f6b5fac52e0f36e /src | |
parent | 6a03dfaf79aa0713df17b03880aaedb3fa8984eb (diff) | |
download | ingen-6fc1fa0d3bec4b82cb3af4c4e887241087899e7e.tar.gz ingen-6fc1fa0d3bec4b82cb3af4c4e887241087899e7e.tar.bz2 ingen-6fc1fa0d3bec4b82cb3af4c4e887241087899e7e.zip |
Added atomic int/pointer classes to Raul.
Added multi-writer queue to Raul.
Renamed Queue SRSWQueue (single-reader single-writer).
Updated patchage/ingen for Raul changes.
git-svn-id: http://svn.drobilla.net/lad/ingen@264 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/client/ThreadedSigClientInterface.cpp | 5 | ||||
-rw-r--r-- | src/libs/client/ThreadedSigClientInterface.h | 6 | ||||
-rw-r--r-- | src/libs/engine/Engine.cpp | 1 | ||||
-rw-r--r-- | src/libs/engine/JackAudioDriver.cpp | 1 | ||||
-rw-r--r-- | src/libs/engine/JackMidiDriver.h | 1 | ||||
-rw-r--r-- | src/libs/engine/Maid.cpp | 7 | ||||
-rw-r--r-- | src/libs/engine/Maid.h | 8 | ||||
-rw-r--r-- | src/libs/engine/OSCEngineReceiver.cpp | 1 | ||||
-rw-r--r-- | src/libs/engine/PostProcessor.cpp | 7 | ||||
-rw-r--r-- | src/libs/engine/PostProcessor.h | 8 | ||||
-rw-r--r-- | src/libs/engine/QueuedEngineInterface.cpp | 1 | ||||
-rw-r--r-- | src/libs/engine/QueuedEventSource.h | 15 |
12 files changed, 32 insertions, 29 deletions
diff --git a/src/libs/client/ThreadedSigClientInterface.cpp b/src/libs/client/ThreadedSigClientInterface.cpp index bbe336a6..152f94a6 100644 --- a/src/libs/client/ThreadedSigClientInterface.cpp +++ b/src/libs/client/ThreadedSigClientInterface.cpp @@ -61,9 +61,10 @@ ThreadedSigClientInterface::emit_signals() // thread indefinitely while processing continually arriving events const size_t limit = _sigs.capacity(); size_t num_processed = 0; - while (!_sigs.is_empty() && num_processed++ < limit) { + while (!_sigs.empty() && num_processed++ < limit) { //printf("emit %zu\n", _sigs.fill()); - Closure& ev = _sigs.pop(); + Closure& ev = _sigs.front(); + _sigs.pop(); ev(); ev.disconnect(); } diff --git a/src/libs/client/ThreadedSigClientInterface.h b/src/libs/client/ThreadedSigClientInterface.h index e286fc95..0a2b8652 100644 --- a/src/libs/client/ThreadedSigClientInterface.h +++ b/src/libs/client/ThreadedSigClientInterface.h @@ -22,7 +22,7 @@ #include <sigc++/sigc++.h> #include "interface/ClientInterface.h" #include "SigClientInterface.h" -#include "raul/Queue.h" +#include "raul/SRSWQueue.h" #include "raul/Atom.h" using std::string; @@ -138,8 +138,8 @@ private: bool _enabled; - Queue<Closure> _sigs; - uint32_t _num_plugins; + SRSWQueue<Closure> _sigs; + uint32_t _num_plugins; sigc::slot<void> bundle_begin_slot; sigc::slot<void> bundle_end_slot; diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp index 95bf554f..c7c5f80a 100644 --- a/src/libs/engine/Engine.cpp +++ b/src/libs/engine/Engine.cpp @@ -21,7 +21,6 @@ #include <sys/mman.h> #include <iostream> #include <unistd.h> -#include "raul/Queue.h" #include "Event.h" #include "JackAudioDriver.h" #include "NodeFactory.h" diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp index f4f0ed23..45269b7d 100644 --- a/src/libs/engine/JackAudioDriver.cpp +++ b/src/libs/engine/JackAudioDriver.cpp @@ -26,7 +26,6 @@ #include "QueuedEvent.h" #include "EventSource.h" #include "PostProcessor.h" -#include "raul/Queue.h" #include "Node.h" #include "Patch.h" #include "Port.h" diff --git a/src/libs/engine/JackMidiDriver.h b/src/libs/engine/JackMidiDriver.h index 116eaebd..d61498e5 100644 --- a/src/libs/engine/JackMidiDriver.h +++ b/src/libs/engine/JackMidiDriver.h @@ -21,7 +21,6 @@ #include <jack/midiport.h> #include "config.h" #include "List.h" -#include "raul/Queue.h" #include "MidiDriver.h" namespace Ingen { diff --git a/src/libs/engine/Maid.cpp b/src/libs/engine/Maid.cpp index b6b4e4c7..005c544f 100644 --- a/src/libs/engine/Maid.cpp +++ b/src/libs/engine/Maid.cpp @@ -19,7 +19,7 @@ Maid::Maid(size_t size) -: m_objects(size) +: _objects(size) { } @@ -37,8 +37,9 @@ Maid::cleanup() { MaidObject* obj = NULL; - while (!m_objects.is_empty()) { - obj = m_objects.pop(); + while (!_objects.empty()) { + obj = _objects.front(); + _objects.pop(); delete obj; } } diff --git a/src/libs/engine/Maid.h b/src/libs/engine/Maid.h index 665ffa05..d8dbfc7e 100644 --- a/src/libs/engine/Maid.h +++ b/src/libs/engine/Maid.h @@ -18,7 +18,7 @@ #define MAID_H #include <boost/utility.hpp> -#include "raul/Queue.h" +#include "raul/SRSWQueue.h" #include "MaidObject.h" @@ -28,7 +28,7 @@ * objects - push() is realtime safe. * * cleanup() is meant to be called periodically to free memory, often - * enough to prevent the queue from overdflowing. This is done by the + * enough to prevent the queue from overflowing. This is done by the * main thread (in Ingen.cpp) since it has nothing better to do. * * \ingroup engine @@ -44,7 +44,7 @@ public: void cleanup(); private: - Queue<MaidObject*> m_objects; + SRSWQueue<MaidObject*> _objects; }; @@ -54,7 +54,7 @@ inline void Maid::push(MaidObject* obj) { if (obj != NULL) - m_objects.push(obj); + _objects.push(obj); } diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp index 35dd5bcb..5e1590e7 100644 --- a/src/libs/engine/OSCEngineReceiver.cpp +++ b/src/libs/engine/OSCEngineReceiver.cpp @@ -20,7 +20,6 @@ #include <string> #include <lo/lo.h> #include "types.h" -#include "raul/Queue.h" #include "raul/SharedPtr.h" #include "raul/AtomLiblo.h" #include "QueuedEventSource.h" diff --git a/src/libs/engine/PostProcessor.cpp b/src/libs/engine/PostProcessor.cpp index 264e4f6f..6c8555e4 100644 --- a/src/libs/engine/PostProcessor.cpp +++ b/src/libs/engine/PostProcessor.cpp @@ -19,7 +19,7 @@ #include <iostream> #include <pthread.h> #include "Event.h" -#include "raul/Queue.h" +#include "raul/SRSWQueue.h" #include "Maid.h" @@ -43,8 +43,9 @@ PostProcessor::PostProcessor(Maid& maid, size_t queue_size) void PostProcessor::_whipped() { - while ( ! _events.is_empty()) { - Event* const ev = _events.pop(); + while ( ! _events.empty()) { + Event* const ev = _events.front(); + _events.pop(); assert(ev); ev->post_process(); _maid.push(ev); diff --git a/src/libs/engine/PostProcessor.h b/src/libs/engine/PostProcessor.h index 5b66c9fc..48d0792d 100644 --- a/src/libs/engine/PostProcessor.h +++ b/src/libs/engine/PostProcessor.h @@ -19,7 +19,7 @@ #include <pthread.h> #include "types.h" -#include "raul/Queue.h" +#include "raul/SRSWQueue.h" #include "raul/Slave.h" class Maid; @@ -46,9 +46,9 @@ public: inline void push(Event* const ev) { _events.push(ev); } private: - Maid& _maid; - Queue<Event*> _events; - virtual void _whipped(); + Maid& _maid; + SRSWQueue<Event*> _events; + virtual void _whipped(); }; diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index ca6cf8cf..eb07ca8c 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -18,7 +18,6 @@ #include "config.h" #include "QueuedEventSource.h" #include "events.h" -#include "raul/Queue.h" #include "Engine.h" #include "AudioDriver.h" diff --git a/src/libs/engine/QueuedEventSource.h b/src/libs/engine/QueuedEventSource.h index db003a92..077cf7f2 100644 --- a/src/libs/engine/QueuedEventSource.h +++ b/src/libs/engine/QueuedEventSource.h @@ -21,7 +21,7 @@ #include <pthread.h> #include "types.h" #include "raul/Semaphore.h" -#include "raul/Queue.h" +#include "raul/SRSWQueue.h" #include "raul/Slave.h" #include "Event.h" #include "EventSource.h" @@ -80,7 +80,7 @@ private: Semaphore _blocking_semaphore; /** Queue for timestamped events (no pre-processing). */ - Queue<Event*> _stamped_queue; + SRSWQueue<Event*> _stamped_queue; }; @@ -93,9 +93,14 @@ private: inline Event* QueuedEventSource::pop_earliest_stamped_before(const SampleCount time) { - if (!_stamped_queue.is_empty() && _stamped_queue.front()->time() < time) - return _stamped_queue.pop(); - return NULL; + Event* ret = NULL; + + if (!_stamped_queue.empty() && _stamped_queue.front()->time() < time) { + ret = _stamped_queue.front(); + _stamped_queue.pop(); + } + + return ret; } |