13
0

Use Glib::Threads::RecMutex rather than Glib::RecMutex where

available; the latter is deprecated and there is some
evidence to suggest that it is broken on some glibmm
versions (around 2.31.0 ish) See, for example
https://github.com/lightspark/lightspark/issues/168


git-svn-id: svn://localhost/ardour2/branches/3.0@12094 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-04-26 08:44:06 +00:00
parent ec97b8e58d
commit 42d018ffa8
4 changed files with 31 additions and 1 deletions

View File

@ -31,7 +31,9 @@
#include <sys/stat.h>
#include <glib.h>
#ifdef HAVE_GLIB_THREADS_RECMUTEX
#include <glibmm/threads.h>
#endif
#include "pbd/undo.h"
#include "pbd/stateful.h"
@ -253,7 +255,11 @@ public:
int _sort_id;
mutable gint block_notifications;
mutable gint ignore_state_changes;
#ifdef HAVE_GLIB_THREADS_RECMUTEX
mutable Glib::Threads::RecMutex region_lock;
#else
mutable Glib::RecMutex region_lock;
#endif
std::set<boost::shared_ptr<Region> > pending_adds;
std::set<boost::shared_ptr<Region> > pending_removes;
RegionList pending_bounds;

View File

@ -186,7 +186,11 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
its OK to block (for short intervals).
*/
#ifdef HAVE_GLIB_THREADS_RECMUTEX
Glib::Threads::RecMutex::Lock lm (region_lock);
#else
Glib::RecMutex::Lock rm (region_lock);
#endif
/* Find all the regions that are involved in the bit we are reading,
and sort them by descending layer and ascending position.

View File

@ -107,7 +107,11 @@ MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst, framepos_t start, framec
its OK to block (for short intervals).
*/
#ifdef HAVE_GLIB_THREADS_RECMUTEX
Glib::Threads::RecMutex::Lock rm (region_lock);
#else
Glib::RecMutex::Lock rm (region_lock);
#endif
DEBUG_TRACE (DEBUG::MidiPlaylistIO, string_compose ("++++++ %1 .. %2 +++++++ %3 trackers +++++++++++++++++\n",
start, start + dur, _note_trackers.size()));
@ -294,7 +298,11 @@ MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst, framepos_t start, framec
void
MidiPlaylist::clear_note_trackers ()
{
#ifdef HAVE_GLIB_THREADS_RECMUTEX
Glib::Threads::RecMutex::Lock rm (region_lock);
#else
Glib::RecMutex::Lock rm (region_lock);
#endif
for (NoteTrackers::iterator n = _note_trackers.begin(); n != _note_trackers.end(); ++n) {
delete n->second;
}
@ -399,7 +407,11 @@ MidiPlaylist::contained_automation()
its OK to block (for short intervals).
*/
#ifdef HAVE_GLIB_THREADS_RECMUTEX
Glib::Threads::RecMutex::Lock rm (region_lock);
#else
Glib::RecMutex::Lock rm (region_lock);
#endif
set<Evoral::Parameter> ret;

View File

@ -548,6 +548,14 @@ def configure(conf):
autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18')
autowaf.check_pkg(conf, 'giomm-2.4', uselib_store='GIOMM', atleast_version='2.2')
conf.check_cxx(fragment = '#include <glibmm/threads.h>\nstatic Glib::Threads::RecMutex foo;\nint main () {}',
uselib = ['GLIBMM'],
msg = 'Checking for Glib::Threads::RecMutex',
mandatory = False,
okmsg = 'yes',
errmsg = 'no; using deprecated API',
define_name = 'HAVE_GLIB_THREADS_RECMUTEX')
for i in children:
sub_config_and_use(conf, i)