mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
gcc-11 compat, volatile atomic variables (2/2)
GUI part of previous commit.
This commit is contained in:
parent
cc7b8b1bc5
commit
8b4edaa950
5 changed files with 16 additions and 11 deletions
|
|
@ -53,7 +53,6 @@ MidiTracer::MidiTracer ()
|
||||||
, autoscroll (true)
|
, autoscroll (true)
|
||||||
, show_hex (true)
|
, show_hex (true)
|
||||||
, show_delta_time (false)
|
, show_delta_time (false)
|
||||||
, _update_queued (0)
|
|
||||||
, fifo (1024)
|
, fifo (1024)
|
||||||
, buffer_pool ("miditracer", buffer_size, 1024) // 1024 256 byte buffers
|
, buffer_pool ("miditracer", buffer_size, 1024) // 1024 256 byte buffers
|
||||||
, autoscroll_button (_("Auto-Scroll"))
|
, autoscroll_button (_("Auto-Scroll"))
|
||||||
|
|
@ -61,6 +60,8 @@ MidiTracer::MidiTracer ()
|
||||||
, collect_button (_("Enabled"))
|
, collect_button (_("Enabled"))
|
||||||
, delta_time_button (_("Delta times"))
|
, delta_time_button (_("Delta times"))
|
||||||
{
|
{
|
||||||
|
g_atomic_int_set (&_update_queued, 0);
|
||||||
|
|
||||||
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect
|
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect
|
||||||
(_manager_connection, invalidator (*this), boost::bind (&MidiTracer::ports_changed, this), gui_context());
|
(_manager_connection, invalidator (*this), boost::bind (&MidiTracer::ports_changed, this), gui_context());
|
||||||
|
|
||||||
|
|
@ -407,9 +408,8 @@ MidiTracer::tracer (Parser&, byte* msg, size_t len, samplecnt_t now)
|
||||||
|
|
||||||
fifo.write (&buf, 1);
|
fifo.write (&buf, 1);
|
||||||
|
|
||||||
if (g_atomic_int_get (const_cast<gint*> (&_update_queued)) == 0) {
|
if (g_atomic_int_compare_and_exchange (&_update_queued, 0, 1)) {
|
||||||
gui_context()->call_slot (invalidator (*this), boost::bind (&MidiTracer::update, this));
|
gui_context()->call_slot (invalidator (*this), boost::bind (&MidiTracer::update, this));
|
||||||
g_atomic_int_inc (const_cast<gint*> (&_update_queued));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -417,7 +417,7 @@ void
|
||||||
MidiTracer::update ()
|
MidiTracer::update ()
|
||||||
{
|
{
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
g_atomic_int_dec_and_test (const_cast<gint*> (&_update_queued));
|
g_atomic_int_set (&_update_queued, 0);
|
||||||
|
|
||||||
RefPtr<TextBuffer> buf (text.get_buffer());
|
RefPtr<TextBuffer> buf (text.get_buffer());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@
|
||||||
#include "pbd/signals.h"
|
#include "pbd/signals.h"
|
||||||
#include "pbd/ringbuffer.h"
|
#include "pbd/ringbuffer.h"
|
||||||
#include "pbd/pool.h"
|
#include "pbd/pool.h"
|
||||||
|
#include "pbd/g_atomic_compat.h"
|
||||||
|
|
||||||
#include "midi++/types.h"
|
#include "midi++/types.h"
|
||||||
#include "ardour_window.h"
|
#include "ardour_window.h"
|
||||||
|
|
||||||
|
|
@ -68,7 +70,7 @@ private:
|
||||||
* equal to 0 when an update is not queued. May temporarily be negative if a
|
* equal to 0 when an update is not queued. May temporarily be negative if a
|
||||||
* update is handled before it was noted that it had just been queued.
|
* update is handled before it was noted that it had just been queued.
|
||||||
*/
|
*/
|
||||||
volatile gint _update_queued;
|
GATOMIC_QUAL gint _update_queued;
|
||||||
|
|
||||||
PBD::RingBuffer<char *> fifo;
|
PBD::RingBuffer<char *> fifo;
|
||||||
Pool buffer_pool;
|
Pool buffer_pool;
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ sigc::signal<void> PublicEditor::DropDownKeys;
|
||||||
|
|
||||||
PublicEditor::PublicEditor (Gtk::Widget& content)
|
PublicEditor::PublicEditor (Gtk::Widget& content)
|
||||||
: Tabbable (content, _("Editor"), X_("editor"))
|
: Tabbable (content, _("Editor"), X_("editor"))
|
||||||
, _suspend_route_redisplay_counter (0)
|
|
||||||
{
|
{
|
||||||
|
g_atomic_int_set (&_suspend_route_redisplay_counter, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PublicEditor::~PublicEditor()
|
PublicEditor::~PublicEditor()
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@
|
||||||
#include <sigc++/signal.h>
|
#include <sigc++/signal.h>
|
||||||
|
|
||||||
#include "pbd/statefuldestructible.h"
|
#include "pbd/statefuldestructible.h"
|
||||||
|
#include "pbd/g_atomic_compat.h"
|
||||||
|
|
||||||
#include "temporal/beats.h"
|
#include "temporal/beats.h"
|
||||||
|
|
||||||
|
|
@ -523,7 +524,8 @@ protected:
|
||||||
friend class DisplaySuspender;
|
friend class DisplaySuspender;
|
||||||
virtual void suspend_route_redisplay () = 0;
|
virtual void suspend_route_redisplay () = 0;
|
||||||
virtual void resume_route_redisplay () = 0;
|
virtual void resume_route_redisplay () = 0;
|
||||||
gint _suspend_route_redisplay_counter;
|
|
||||||
|
GATOMIC_QUAL gint _suspend_route_redisplay_counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DisplaySuspender {
|
class DisplaySuspender {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
#include "pbd/timer.h"
|
#include "pbd/timer.h"
|
||||||
#include "pbd/debug.h"
|
#include "pbd/debug.h"
|
||||||
#include "pbd/compose.h"
|
#include "pbd/compose.h"
|
||||||
|
#include "pbd/g_atomic_compat.h"
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
@ -87,8 +88,8 @@ public:
|
||||||
, rapid(100)
|
, rapid(100)
|
||||||
, super_rapid(40)
|
, super_rapid(40)
|
||||||
, fps(40)
|
, fps(40)
|
||||||
, _suspend_counter(0)
|
|
||||||
{
|
{
|
||||||
|
g_atomic_int_set (&_suspend_counter, 0);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
second.connect (sigc::mem_fun (*this, &UITimers::on_second_timer));
|
second.connect (sigc::mem_fun (*this, &UITimers::on_second_timer));
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -100,7 +101,7 @@ public:
|
||||||
StandardTimer super_rapid;
|
StandardTimer super_rapid;
|
||||||
StandardTimer fps;
|
StandardTimer fps;
|
||||||
|
|
||||||
gint _suspend_counter;
|
GATOMIC_QUAL gint _suspend_counter;
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
std::vector<uint64_t> rapid_eps_count;
|
std::vector<uint64_t> rapid_eps_count;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue