disgusting hack around mutex problem that has been delaying beta19, hopefully to be removed once we understand the issue better

git-svn-id: svn://localhost/ardour2/trunk@1591 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-03-15 01:57:00 +00:00
parent f74981874f
commit f3d8efcea9
5 changed files with 24 additions and 5 deletions

View file

@ -33,6 +33,7 @@
#include <pbd/fastlog.h>
#include <pbd/ringbufferNPT.h>
#include <pbd/stateful.h>
#include <pbd/mutex.h>
#include <pbd/statefuldestructible.h>
#include <ardour/ardour.h>
@ -237,7 +238,7 @@ class IO;
static nframes_t disk_io_chunk_frames;
vector<CaptureInfo*> capture_info;
Glib::Mutex capture_info_lock;
PBDMutex capture_info_lock;
uint32_t i_am_the_modifier;
@ -292,7 +293,7 @@ class IO;
AlignStyle _persistent_alignment_style;
bool first_input_change;
Glib::Mutex state_lock;
PBDMutex state_lock;
nframes_t scrub_start;
nframes_t scrub_buffer_size;

View file

@ -127,6 +127,8 @@ AudioDiskstream::~AudioDiskstream ()
}
channels.clear();
}
state_lock.lock ();
}
void
@ -539,7 +541,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_
// If we can't take the state lock return.
if (!state_lock.trylock()) {
return 1;
}
}
adjust_capture_position = 0;
@ -825,7 +827,6 @@ AudioDiskstream::commit (nframes_t nframes)
}
state_lock.unlock();
_processed = false;
return need_butler;

View file

@ -592,7 +592,7 @@ AudioSource::build_peaks_from_scratch ()
Glib::Mutex::Lock lp (_lock);
if (prepare_for_peakfile_writes ()) {
return -1;
goto out;
}
current_frame = 0;

View file

@ -356,6 +356,7 @@ void
Diskstream::playlist_modified ()
{
if (!i_am_the_modifier && !overwrite_queued) {
cerr << _name << " request overwrite\n";
_session.request_overwrite_buffer (this);
overwrite_queued = true;
}

16
libs/pbd/pbd/mutex.h Normal file
View file

@ -0,0 +1,16 @@
#include <glibmm/thread.h>
#include <iostream>
class PBDMutex : public Glib::Mutex
{
public:
PBDMutex() : Glib::Mutex() {}
~PBDMutex() {
if (trylock()) {
unlock ();
} else {
std::cerr << "Mutex @ " << this << " locked during destructor\n";
unlock ();
}
}
};