diff options
author | David Robillard <d@drobilla.net> | 2010-01-05 03:51:50 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-01-05 03:51:50 +0000 |
commit | c67392abf59b500fe405101d7ad896d9da869e47 (patch) | |
tree | 53b5d5b27d4389caa123c5deb2a1e0aadf180ec7 /src/engine/ConnectionImpl.cpp | |
parent | 4c32f20699db0ede850a9485271dfda779761fac (diff) | |
download | ingen-c67392abf59b500fe405101d7ad896d9da869e47.tar.gz ingen-c67392abf59b500fe405101d7ad896d9da869e47.tar.bz2 ingen-c67392abf59b500fe405101d7ad896d9da869e47.zip |
Realtime safe buffer reference handling.
Turns out that dropping a shared_ptr is not realtime safe, even if you use
a realtime safe deleter. Instead, instrusive_ptr is used for buffer
references, so a buffer reference may safely be dropped in the audio
thread (in which case it will be recycled by the BufferFactory).
Faster, cleaner, better.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2341 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/ConnectionImpl.cpp')
-rw-r--r-- | src/engine/ConnectionImpl.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp index f934fc21..6317c632 100644 --- a/src/engine/ConnectionImpl.cpp +++ b/src/engine/ConnectionImpl.cpp @@ -17,6 +17,7 @@ #include <algorithm> #include "raul/Maid.hpp" +#include "raul/IntrusivePtr.hpp" #include "AudioBuffer.hpp" #include "BufferFactory.hpp" #include "ConnectionImpl.hpp" @@ -103,13 +104,13 @@ void ConnectionImpl::process(Context& context) { if (must_queue()) { - SharedPtr<EventBuffer> src_buf = PtrCast<EventBuffer>(_src_port->buffer(0)); + IntrusivePtr<EventBuffer> src_buf = PtrCast<EventBuffer>(_src_port->buffer(0)); if (!src_buf) { cerr << "ERROR: Queued connection but source is not an EventBuffer" << endl; return; } - SharedPtr<ObjectBuffer> local_buf = PtrCast<ObjectBuffer>(_local_buffer); + IntrusivePtr<ObjectBuffer> local_buf = PtrCast<ObjectBuffer>(_local_buffer); if (!local_buf) { cerr << "ERROR: Queued connection but source is not an EventBuffer" << endl; return; @@ -138,7 +139,7 @@ ConnectionImpl::queue(Context& context) if (!must_queue()) return; - SharedPtr<EventBuffer> src_buf = PtrCast<EventBuffer>(_src_port->buffer(0)); + IntrusivePtr<EventBuffer> src_buf = PtrCast<EventBuffer>(_src_port->buffer(0)); if (!src_buf) { cerr << "ERROR: Queued connection but source is not an EventBuffer" << endl; return; |