mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
clean up RCU fix even more; nedko's missing sources patch
git-svn-id: svn://localhost/ardour2/trunk@1514 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
44a3f5419b
commit
3f95dc7a08
4 changed files with 24 additions and 14 deletions
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <ardour/audioregion.h>
|
||||
#include <ardour/audiofilesource.h>
|
||||
#include <ardour/silentfilesource.h>
|
||||
#include <ardour/session_region.h>
|
||||
|
||||
#include <gtkmm2ext/stop_signal.h>
|
||||
|
|
@ -85,6 +86,9 @@ Editor::add_audio_region_to_region_display (boost::shared_ptr<AudioRegion> regio
|
|||
string str;
|
||||
TreeModel::Row row;
|
||||
Gdk::Color c;
|
||||
bool missing_source;
|
||||
|
||||
missing_source = boost::dynamic_pointer_cast<SilentFileSource>(region->source());
|
||||
|
||||
if (!show_automatic_regions_in_region_list && region->automatic()) {
|
||||
return;
|
||||
|
|
@ -124,7 +128,11 @@ Editor::add_audio_region_to_region_display (boost::shared_ptr<AudioRegion> regio
|
|||
} else if (region->whole_file()) {
|
||||
|
||||
row = *(region_list_model->append());
|
||||
set_color(c, rgba_from_style ("RegionListWholeFile", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false ));
|
||||
if (missing_source) {
|
||||
c.set_rgb(65535,0,0); // FIXME: error color from style
|
||||
} else {
|
||||
set_color(c, rgba_from_style ("RegionListWholeFile", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false ));
|
||||
}
|
||||
row[region_list_columns.color_] = c;
|
||||
|
||||
if (region->source()->name()[0] == '/') { // external file
|
||||
|
|
@ -150,6 +158,10 @@ Editor::add_audio_region_to_region_display (boost::shared_ptr<AudioRegion> regio
|
|||
|
||||
}
|
||||
|
||||
if (missing_source) {
|
||||
str += " (MISSING)";
|
||||
}
|
||||
|
||||
row[region_list_columns.name] = str;
|
||||
row[region_list_columns.region] = region;
|
||||
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ Session::GlobalMeteringStateCommand::get_state()
|
|||
if (r) {
|
||||
child->add_property (X_("id"), r->id().to_s());
|
||||
|
||||
const char* meterstr;
|
||||
const char* meterstr = 0;
|
||||
|
||||
switch (x->second) {
|
||||
case MeterInput:
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ Session::set_mmc_device_id (uint32_t device_id)
|
|||
int
|
||||
Session::set_mmc_port (string port_tag)
|
||||
{
|
||||
MIDI::byte old_device_id;
|
||||
MIDI::byte old_device_id = 0;
|
||||
bool reset_id = false;
|
||||
|
||||
if (port_tag.length() == 0) {
|
||||
|
|
|
|||
|
|
@ -10,23 +10,21 @@ template<class T>
|
|||
class RCUManager
|
||||
{
|
||||
public:
|
||||
|
||||
RCUManager (T* new_rcu_value) {
|
||||
x.m_rcu_value = new boost::shared_ptr<T> (new_rcu_value);
|
||||
m_rcu_value = new boost::shared_ptr<T> (new_rcu_value);
|
||||
}
|
||||
|
||||
virtual ~RCUManager() { delete m_rcu_value; }
|
||||
|
||||
virtual ~RCUManager() { delete x.m_rcu_value; }
|
||||
|
||||
boost::shared_ptr<T> reader () const { return *((boost::shared_ptr<T> *) g_atomic_pointer_get (&x.gptr)); }
|
||||
boost::shared_ptr<T> reader () const { return *((boost::shared_ptr<T> *) g_atomic_pointer_get ((volatile gpointer*) &m_rcu_value)); }
|
||||
|
||||
virtual boost::shared_ptr<T> write_copy () = 0;
|
||||
virtual bool update (boost::shared_ptr<T> new_value) = 0;
|
||||
|
||||
volatile gpointer* pointer() const { return (volatile gpointer*) &m_rcu_value; }
|
||||
|
||||
protected:
|
||||
union {
|
||||
boost::shared_ptr<T>* m_rcu_value;
|
||||
volatile gpointer gptr;
|
||||
} x;
|
||||
volatile boost::shared_ptr<T>* m_rcu_value;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -59,7 +57,7 @@ public:
|
|||
|
||||
// store the current
|
||||
|
||||
current_write_old = RCUManager<T>::x.m_rcu_value;
|
||||
current_write_old = (boost::shared_ptr<T>*) RCUManager<T>::m_rcu_value;
|
||||
|
||||
boost::shared_ptr<T> new_copy (new T(**current_write_old));
|
||||
|
||||
|
|
@ -75,7 +73,7 @@ public:
|
|||
|
||||
// update, checking that nobody beat us to it
|
||||
|
||||
bool ret = g_atomic_pointer_compare_and_exchange (&RCUManager<T>::x.gptr,
|
||||
bool ret = g_atomic_pointer_compare_and_exchange (RCUManager<T>::pointer(),
|
||||
(gpointer) current_write_old,
|
||||
(gpointer) new_spp);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue