From 8e7a5d77414a40550a28d61abf6eeb1e89a1ec25 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 25 Jun 2009 20:46:39 +0000 Subject: 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 --- libs/ardour/internal_return.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'libs/ardour/internal_return.cc') 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); } } -- cgit v1.2.3