summaryrefslogtreecommitdiff
path: root/libs/ardour/internal_return.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-06-25 20:46:39 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-06-25 20:46:39 +0000
commit8e7a5d77414a40550a28d61abf6eeb1e89a1ec25 (patch)
tree76d5851fe7221066ccadbc032a9a1fbcd1b6091b /libs/ardour/internal_return.cc
parent94880f7cd1417031387b485e279c32eea885cf6d (diff)
startup assistant patch from tinman; cleanup fix backported from 2.X ; easy(ier) ways to create aux sends ; facility to subgroup (route via bus) for a route group ; fix up internal send/return operation ; fix internal send naming since it doesn't need to be unique - no JACK ports involved
git-svn-id: svn://localhost/ardour2/branches/3.0@5272 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/internal_return.cc')
-rw-r--r--libs/ardour/internal_return.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc
index 409c87d93c..0a45228c67 100644
--- a/libs/ardour/internal_return.cc
+++ b/libs/ardour/internal_return.cc
@@ -46,13 +46,13 @@ InternalReturn::InternalReturn (Session& s, const XMLNode& node)
void
InternalReturn::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
{
- if (user_count == 0) {
+ /* XXX no lock here, just atomic fetch */
+
+ if (g_atomic_int_get(&user_count) == 0) {
/* nothing to do - nobody is feeding us anything */
return;
}
- /* XXX this should be merge() */
-
bufs.merge_from (buffers, nframes);
}
@@ -81,7 +81,10 @@ BufferSet*
InternalReturn::get_buffers ()
{
Glib::Mutex::Lock lm (_session.engine().process_lock());
- user_count++;
+ /* use of g_atomic here is just for code consistency - its protected by the lock
+ for writing.
+ */
+ g_atomic_int_inc (&user_count);
return &buffers;
}
@@ -90,7 +93,10 @@ InternalReturn::release_buffers ()
{
Glib::Mutex::Lock lm (_session.engine().process_lock());
if (user_count) {
- user_count--;
+ /* use of g_atomic here is just for code consistency - its protected by the lock
+ for writing.
+ */
+ (void) g_atomic_int_dec_and_test (&user_count);
}
}