{
track_list_ready = false;
{
- Glib::Mutex::Lock lm (track_list_lock);
+ Glib::Threads::Mutex::Lock lm (track_list_lock);
// Empty track list & free old graphs
clear_tracklist();
#include <gtkmm2ext/dndtreeview.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/session_handle.h"
FFTGraph fft_graph;
bool track_list_ready;
- Glib::Mutex track_list_lock;
+ Glib::Threads::Mutex track_list_lock;
friend class FFTGraph;
};
FFTGraph::setWindowSize(int windowSize)
{
if (_a_window) {
- Glib::Mutex::Lock lm (_a_window->track_list_lock);
+ Glib::Threads::Mutex::Lock lm (_a_window->track_list_lock);
setWindowSize_internal(windowSize);
} else {
setWindowSize_internal(windowSize);
void
FFTGraph::redraw()
{
- Glib::Mutex::Lock lm (_a_window->track_list_lock);
+ Glib::Threads::Mutex::Lock lm (_a_window->track_list_lock);
draw_scales(get_window());
#include "pbd/convert.h"
#include "pbd/unwind.h"
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/utils.h>
/* XXX need processor lock on route */
try {
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock());
send->output()->ensure_io (outs, false, this);
} catch (AudioEngine::PortRegistrationFailure& err) {
error << string_compose (_("Cannot set up new send: %1"), err.what()) << endmsg;
#include <algorithm>
#include <inttypes.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/window_title.h>
StripSilenceDialog::update_silence_rects ()
{
/* Lock so that we don't contend with the detection thread for access to the silence regions */
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
double const y = _threshold.get_value();
for (list<ViewInterval>::iterator v = views.begin(); v != views.end(); ++v) {
*/
#include <gtkmm/spinbutton.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/types.h"
#include "ardour_dialog.h"
pthread_t _thread; ///< thread to compute silence in the background
static void * _detection_thread_work (void *);
void * detection_thread_work ();
- Glib::Mutex _lock; ///< lock held while the thread is doing work
- Glib::Cond _run_cond; ///< condition to wake the thread
+ Glib::Threads::Mutex _lock; ///< lock held while the thread is doing work
+ Glib::Threads::Cond _run_cond; ///< condition to wake the thread
bool _thread_should_finish; ///< true if the thread should terminate
PBD::Signal0<void> Completed; ///< emitted when a silence detection has completed
PBD::ScopedConnection _completed_connection;
void
Amp::setup_gain_automation (framepos_t start_frame, framepos_t end_frame, framecnt_t nframes)
{
- Glib::Mutex::Lock am (control_lock(), Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock am (control_lock(), Glib::Threads::TRY_LOCK);
if (am.locked() && _session.transport_rolling() && _gain_control->automation_playback()) {
assert (_gain_automation_buffer);
using namespace PBD;
Analyser* Analyser::the_analyser = 0;
-Glib::StaticMutex Analyser::analysis_queue_lock = GLIBMM_STATIC_MUTEX_INIT;
-Glib::Cond* Analyser::SourcesToAnalyse = 0;
+Glib::Threads::Mutex Analyser::analysis_queue_lock;
+Glib::Threads::Cond Analyser::SourcesToAnalyse;
list<boost::weak_ptr<Source> > Analyser::analysis_queue;
Analyser::Analyser ()
void
Analyser::init ()
{
- SourcesToAnalyse = new Glib::Cond();
- Glib::Thread::create (sigc::ptr_fun (analyser_work), false);
+ Glib::Threads::Thread::create (sigc::ptr_fun (analyser_work));
}
void
return;
}
- Glib::Mutex::Lock lm (analysis_queue_lock);
+ Glib::Threads::Mutex::Lock lm (analysis_queue_lock);
analysis_queue.push_back (boost::weak_ptr<Source>(src));
- SourcesToAnalyse->broadcast ();
+ SourcesToAnalyse.broadcast ();
}
void
wait:
if (analysis_queue.empty()) {
- SourcesToAnalyse->wait (analysis_queue_lock);
+ SourcesToAnalyse.wait (analysis_queue_lock);
}
if (analysis_queue.empty()) {
#ifndef __ardour_analyser_h__
#define __ardour_analyser_h__
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <boost/shared_ptr.hpp>
namespace ARDOUR {
private:
static Analyser* the_analyser;
- static Glib::StaticMutex analysis_queue_lock;
- static Glib::Cond* SourcesToAnalyse;
+ static Glib::Threads::Mutex analysis_queue_lock;
+ static Glib::Threads::Cond SourcesToAnalyse;
static std::list<boost::weak_ptr<Source> > analysis_queue;
static void analyse_audio_file_source (boost::shared_ptr<AudioFileSource>);
#include <exception>
#include <string>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/rcu.h"
#include "pbd/signals.h"
int start ();
bool running() const { return _running; }
- Glib::Mutex& process_lock() { return _process_lock; }
+ Glib::Threads::Mutex& process_lock() { return _process_lock; }
framecnt_t frame_rate () const;
pframes_t frames_per_cycle () const;
jack_client_t* volatile _jack; /* could be reset to null by SIGPIPE or another thread */
std::string jack_client_name;
- Glib::Mutex _process_lock;
- Glib::Cond session_removed;
+ Glib::Threads::Mutex _process_lock;
+ Glib::Threads::Cond session_removed;
bool session_remove_pending;
frameoffset_t session_removal_countdown;
gain_t session_removal_gain;
bool _pre_freewheel_mmc_enabled;
int _usecs_per_cycle;
bool port_remove_in_progress;
- Glib::Thread* m_meter_thread;
+ Glib::Threads::Thread* m_meter_thread;
ProcessThread* _main_thread;
SerializedRCUManager<Ports> ports;
#include <time.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <boost/function.hpp>
#include "ardour/source.h"
static std::vector<boost::shared_ptr<Sample> > _mixdown_buffers;
static std::vector<boost::shared_ptr<gain_t> > _gain_buffers;
- static Glib::StaticMutex _level_buffer_lock;
+ static Glib::Threads::Mutex _level_buffer_lock;
static void ensure_buffers_for_level (uint32_t, framecnt_t);
static void ensure_buffers_for_level_locked (uint32_t, framecnt_t);
* PeaksReady means that _peaks_built cannot be changed
* during the handling of the signal.
*/
- mutable Glib::Mutex _peaks_ready_lock;
+ mutable Glib::Threads::Mutex _peaks_ready_lock;
PBD::FdFileDescriptor* _peakfile_descriptor;
int _peakfile_fd;
#include <string>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/ardour.h"
#include "ardour/audio_track.h"
boost::shared_ptr<AudioRegion> the_region;
framepos_t current_frame;
mutable gint _auditioning;
- Glib::Mutex lock;
+ Glib::Threads::Mutex lock;
framecnt_t length;
bool via_monitor;
#define __ardour_auto_bundle_h__
#include <vector>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/bundle.h"
namespace ARDOUR {
#include <list>
#include <cmath>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/undo.h"
#include "pbd/xml++.h"
#include <list>
#include <boost/shared_ptr.hpp>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <sigc++/signal.h>
#include "pbd/signals.h"
~AutomationWatch();
static AutomationWatch* _instance;
- Glib::Thread* _thread;
+ Glib::Threads::Thread* _thread;
bool _run_thread;
AutomationWatches automation_watches;
- Glib::Mutex automation_watch_lock;
+ Glib::Threads::Mutex automation_watch_lock;
PBD::ScopedConnection transport_connection;
void transport_state_change ();
#include "ardour/chan_count.h"
#include <list>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
namespace ARDOUR {
static void ensure_buffers (ChanCount howmany = ChanCount::ZERO);
private:
- static Glib::StaticMutex rb_mutex;
+ static Glib::Threads::Mutex rb_mutex;
typedef PBD::RingBufferNPT<ThreadBuffers*> ThreadBufferFIFO;
typedef std::list<ThreadBuffers*> ThreadBufferList;
#include <string>
#include <vector>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <boost/shared_ptr.hpp>
#include "pbd/signals.h"
/// mutex for _channel_ports and _channel_names
/// XXX: is this necessary?
- mutable Glib::Mutex _channel_mutex;
+ mutable Glib::Threads::Mutex _channel_mutex;
std::vector<Channel> _channel;
private:
#ifndef __ardour_butler_h__
#define __ardour_butler_h__
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/ringbuffer.h"
#include "pbd/pool.h"
};
pthread_t thread;
- Glib::Mutex request_lock;
- Glib::Cond paused;
+ Glib::Threads::Mutex request_lock;
+ Glib::Threads::Cond paused;
bool should_run;
mutable gint should_do_transport_work;
int request_pipe[2];
#include <list>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/stateful.h"
#include "ardour/session_handle.h"
ControlProtocolManager ();
static ControlProtocolManager* _instance;
- Glib::Mutex protocols_lock;
+ Glib::Threads::Mutex protocols_lock;
std::list<ControlProtocol*> control_protocols;
void session_going_away ();
static framecnt_t disk_io_chunk_frames;
std::vector<CaptureInfo*> capture_info;
- mutable Glib::Mutex capture_info_lock;
+ mutable Glib::Threads::Mutex capture_info_lock;
uint32_t i_am_the_modifier;
bool in_set_state;
- Glib::Mutex state_lock;
+ Glib::Threads::Mutex state_lock;
PBD::ScopedConnectionList playlist_connections;
bool _graph_empty;
// chain swapping
- Glib::Mutex _swap_mutex;
- Glib::Cond _cleanup_cond;
+ Glib::Threads::Mutex _swap_mutex;
+ Glib::Threads::Cond _cleanup_cond;
volatile int _current_chain;
volatile int _pending_chain;
volatile int _setup_chain;
/** sends that we are receiving data from */
std::list<InternalSend*> _sends;
/** mutex to protect _sends */
- Glib::Mutex _sends_mutex;
+ Glib::Threads::Mutex _sends_mutex;
};
} // namespace ARDOUR
#include <cmath>
#include <jack/jack.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/fastlog.h"
#include "pbd/undo.h"
int set_ports (const std::string& str);
private:
- mutable Glib::Mutex io_lock;
+ mutable Glib::Threads::Mutex io_lock;
protected:
PortSet _ports;
#include <string>
#include <boost/shared_ptr.hpp>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/undo.h"
#include <sys/types.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/undo.h"
#include "pbd/stateful.h"
PBD::Signal1<void,const PBD::PropertyChange&> StateChanged;
template<class T> void apply (T& obj, void (T::*method)(LocationList&)) {
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
(obj.*method)(locations);
}
template<class T1, class T2> void apply (T1& obj, void (T1::*method)(LocationList&, T2& arg), T2& arg) {
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
(obj.*method)(locations, arg);
}
LocationList locations;
Location *current_location;
- mutable Glib::Mutex lock;
+ mutable Glib::Threads::Mutex lock;
int set_current_unlocked (Location *);
void location_changed (Location*);
#define __ardour_logcurve_h__
#include "pbd/fastlog.h"
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
namespace ARDOUR {
}
void set_length (uint32_t len) { l = len; }
- mutable Glib::Mutex lock;
+ mutable Glib::Threads::Mutex lock;
protected:
float a;
the GUI to read (so that it can update itself).
*/
MidiBuffer _gui_feed_buffer;
- mutable Glib::Mutex _gui_feed_buffer_mutex;
+ mutable Glib::Threads::Mutex _gui_feed_buffer_mutex;
};
}; /* namespace ARDOUR */
#include <deque>
#include <utility>
#include <boost/utility.hpp>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/command.h"
#include "ardour/types.h"
#include "ardour/midi_buffer.h"
private:
struct WriteLockImpl : public AutomatableSequence<TimeType>::WriteLockImpl {
- WriteLockImpl(Glib::Mutex::Lock* source_lock, Glib::RWLock& s, Glib::Mutex& c)
+ WriteLockImpl(Glib::Threads::Mutex::Lock* slock, Glib::Threads::RWLock& s, Glib::Threads::Mutex& c)
: AutomatableSequence<TimeType>::WriteLockImpl(s, c)
- , source_lock(source_lock)
+ , source_lock (slock)
{}
~WriteLockImpl() {
delete source_lock;
}
- Glib::Mutex::Lock* source_lock;
+ Glib::Threads::Mutex::Lock* source_lock;
};
public:
#include <string>
#include <time.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <boost/enable_shared_from_this.hpp>
#include "pbd/stateful.h"
#include "pbd/xml++.h"
friend class Session;
protected:
- class RegionReadLock : public Glib::RWLock::ReaderLock {
+ class RegionReadLock : public Glib::Threads::RWLock::ReaderLock {
public:
- RegionReadLock (Playlist *pl) : Glib::RWLock::ReaderLock (pl->region_lock) {}
+ RegionReadLock (Playlist *pl) : Glib::Threads::RWLock::ReaderLock (pl->region_lock) {}
~RegionReadLock() {}
};
- class RegionWriteLock : public Glib::RWLock::WriterLock {
+ class RegionWriteLock : public Glib::Threads::RWLock::WriterLock {
public:
RegionWriteLock (Playlist *pl, bool do_block_notify = true)
- : Glib::RWLock::WriterLock (pl->region_lock)
+ : Glib::Threads::RWLock::WriterLock (pl->region_lock)
, playlist (pl)
, block_notify (do_block_notify) {
if (block_notify) {
}
~RegionWriteLock() {
- Glib::RWLock::WriterLock::release ();
+ Glib::Threads::RWLock::WriterLock::release ();
if (block_notify) {
playlist->release_notifications ();
}
private:
friend class RegionReadLock;
friend class RegionWriteLock;
- mutable Glib::RWLock region_lock;
+ mutable Glib::Threads::RWLock region_lock;
private:
void setup_layering_indices (RegionList const &);
#ifndef __libardour_process_thread__
#define __libardour_process_thread__
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/chan_count.h"
#include "ardour/types.h"
void session_going_away ();
private:
- static Glib::Private<ThreadBuffers>* _private_thread_buffers;
+ static Glib::Threads::Private<ThreadBuffers> _private_thread_buffers;
};
} // namespace
#include <map>
#include <set>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/id.h"
#include "pbd/property_list.h"
static void region_changed (PBD::PropertyChange const &, boost::weak_ptr<Region>);
- static Glib::StaticMutex region_map_lock;
+ static Glib::Threads::Mutex region_map_lock;
static RegionMap region_map;
- static Glib::StaticMutex region_name_maps_mutex;
+ static Glib::Threads::Mutex region_name_maps_mutex;
/** map of partial region names and suffix numbers */
static std::map<std::string, uint32_t> region_name_number_map;
/** map of complete region names with their region ID */
#include <boost/dynamic_bitset.hpp>
#include <boost/enable_shared_from_this.hpp>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/fastlog.h"
#include "pbd/xml++.h"
#include "pbd/undo.h"
void flush_processors ();
void foreach_processor (boost::function<void(boost::weak_ptr<Processor>)> method) {
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
if (boost::dynamic_pointer_cast<UnknownProcessor> (*i)) {
break;
}
boost::shared_ptr<Processor> nth_processor (uint32_t n) {
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
ProcessorList::iterator i;
for (i = _processors.begin(); i != _processors.end() && n; ++i, --n) {}
if (i == _processors.end()) {
framecnt_t _roll_delay;
ProcessorList _processors;
- mutable Glib::RWLock _processor_lock;
+ mutable Glib::Threads::RWLock _processor_lock;
boost::shared_ptr<Delivery> _main_outs;
boost::shared_ptr<InternalSend> _monitor_send;
boost::shared_ptr<InternalReturn> _intreturn;
#include <boost/weak_ptr.hpp>
#include <boost/utility.hpp>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/error.h"
#include "pbd/event_loop.h"
/* REGION MANAGEMENT */
- mutable Glib::Mutex region_lock;
+ mutable Glib::Threads::Mutex region_lock;
int load_regions (const XMLNode& node);
int load_compounds (const XMLNode& node);
/* SOURCES */
- mutable Glib::Mutex source_lock;
+ mutable Glib::Threads::Mutex source_lock;
public:
typedef std::map<PBD::ID,boost::shared_ptr<Source> > SourceMap;
could not report free space.
*/
bool _total_free_4k_blocks_uncertain;
- Glib::Mutex space_lock;
+ Glib::Threads::Mutex space_lock;
bool no_questions_about_missing_files;
Sample* click_emphasis_data;
framecnt_t click_length;
framecnt_t click_emphasis_length;
- mutable Glib::RWLock click_lock;
+ mutable Glib::Threads::RWLock click_lock;
static const Sample default_click[];
static const framecnt_t default_click_length;
int find_all_sources_across_snapshots (std::set<std::string>& result, bool exclude_this_snapshot);
typedef std::set<boost::shared_ptr<PBD::Controllable> > Controllables;
- Glib::Mutex controllables_lock;
+ Glib::Threads::Mutex controllables_lock;
Controllables controllables;
boost::shared_ptr<PBD::Controllable> _solo_cut_control;
template<class T> void
SessionPlaylists::foreach (T *obj, void (T::*func)(boost::shared_ptr<Playlist>))
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (List::iterator i = playlists.begin(); i != playlists.end(); i++) {
if (!(*i)->hidden()) {
(obj->*func) (*i);
#include <set>
#include <vector>
#include <string>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
int load_unused (Session &, const XMLNode&);
boost::shared_ptr<Playlist> XMLPlaylistFactory (Session &, const XMLNode&);
- mutable Glib::Mutex lock;
+ mutable Glib::Threads::Mutex lock;
typedef std::set<boost::shared_ptr<Playlist> > List;
List playlists;
List unused_playlists;
#include <iostream>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/session.h"
#include "ardour/route.h"
#include <vector>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <jack/jack.h>
size_t speed_accumulator_cnt;
bool have_first_speed_accumulator;
double average_speed;
- Glib::Mutex reset_lock;
+ Glib::Threads::Mutex reset_lock;
uint32_t reset_pending;
bool reset_position;
#include <string>
#include <set>
-#include <glib.h>
+#include <glibmm/threads.h>
#include <boost/utility.hpp>
#include "pbd/statefuldestructible.h"
void set_allow_remove_if_empty (bool yn);
- Glib::Mutex& mutex() { return _lock; }
+ Glib::Threads::Mutex& mutex() { return _lock; }
Flag flags() const { return _flags; }
virtual void inc_use_count ();
time_t _timestamp;
framepos_t _timeline_position;
bool _analysed;
- mutable Glib::Mutex _lock;
- mutable Glib::Mutex _analysis_lock;
+ mutable Glib::Threads::Mutex _lock;
+ mutable Glib::Threads::Mutex _analysis_lock;
gint _use_count; /* atomic */
uint32_t _level; /* how deeply nested is this source w.r.t a disk file */
#include <stdint.h>
#include <boost/shared_ptr.hpp>
+#include <glibmm/threads.h>
+
#include "ardour/source.h"
class XMLNode;
(DataType type, Session& s, boost::shared_ptr<Playlist> p, const PBD::ID& orig, const std::string& name,
uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, bool defer_peaks);
- static Glib::Cond* PeaksToBuild;
- static Glib::StaticMutex peak_building_lock;
+ static Glib::Threads::Cond PeaksToBuild;
+ static Glib::Threads::Mutex peak_building_lock;
static std::list< boost::weak_ptr<AudioSource> > files_with_peaks;
static int setup_peakfile (boost::shared_ptr<Source>, bool async);
#include <string>
#include <vector>
#include <cmath>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/undo.h"
#include "pbd/stateful.h"
typedef std::vector<BBTPoint> BBTPointList;
template<class T> void apply_with_metrics (T& obj, void (T::*method)(const Metrics&)) {
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
(obj.*method)(metrics);
}
Metrics metrics;
framecnt_t _frame_rate;
- mutable Glib::RWLock lock;
+ mutable Glib::Threads::RWLock lock;
BBTPointList _map;
void recompute_map (bool reassign_tempo_bbt, framepos_t end = -1);
#ifndef __libardour_thread_buffers__
#define __libardour_thread_buffers__
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/chan_count.h"
#include "ardour/types.h"
#define __ardour_user_bundle_h__
#include <vector>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/stateful.h"
#include "ardour/bundle.h"
#include <stdint.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/ringbuffer.h"
#include "pbd/semaphore.h"
private:
void run();
- Workee* _workee;
- Glib::Thread* _thread;
- RingBuffer<uint8_t>* _requests;
- RingBuffer<uint8_t>* _responses;
- uint8_t* _response;
- PBD::Semaphore _sem;
- bool _exit;
+ Workee* _workee;
+ Glib::Threads::Thread* _thread;
+ RingBuffer<uint8_t>* _requests;
+ RingBuffer<uint8_t>* _responses;
+ uint8_t* _response;
+ PBD::Semaphore _sem;
+ bool _exit;
};
} // namespace ARDOUR
AudioDiskstream::non_realtime_input_change ()
{
{
- Glib::Mutex::Lock lm (state_lock);
+ Glib::Threads::Mutex::Lock lm (state_lock);
if (input_change_pending.type == IOChange::NoChange) {
return;
return 0;
}
- Glib::Mutex::Lock sm (state_lock, Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock sm (state_lock, Glib::Threads::TRY_LOCK);
if (!sm.locked()) {
return 1;
ChannelList::iterator chan;
boost::shared_ptr<ChannelList> c = channels.reader();
- Glib::Mutex::Lock lm (state_lock);
+ Glib::Threads::Mutex::Lock lm (state_lock);
for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) {
(*chan)->playback_buf->reset ();
}
/* XXX is there anything we can do if err != 0 ? */
- Glib::Mutex::Lock lm (capture_info_lock);
+ Glib::Threads::Mutex::Lock lm (capture_info_lock);
if (capture_info.empty()) {
return;
with any changes to the list of buffers caused
by creating new nested playlists/sources
*/
- Glib::Mutex::Lock lm (_level_buffer_lock);
+ Glib::Threads::Mutex::Lock lm (_level_buffer_lock);
sbuf = _mixdown_buffers[_level-1];
gbuf = _gain_buffers[_level-1];
}
int
AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler)
{
- Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
return 0;
boost::scoped_array<Sample> mix_buffer (new Sample[nframes]);
boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream();
- Glib::RWLock::ReaderLock rlock (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock rlock (_processor_lock);
boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(diskstream->playlist());
return true;
}
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
uint32_t naudio = n_inputs().n_audio();
for (ProcessorList::const_iterator r = _processors.begin(); r != _processors.end(); ++r) {
_freeze_record.processor_info.clear ();
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::iterator r = _processors.begin(); r != _processors.end(); ++r) {
audio_diskstream()->use_playlist (_freeze_record.playlist);
{
- Glib::RWLock::ReaderLock lm (_processor_lock); // should this be a write lock? jlc
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock); // should this be a write lock? jlc
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
for (vector<FreezeRecordProcessorInfo*>::iterator ii = _freeze_record.processor_info.begin(); ii != _freeze_record.processor_info.end(); ++ii) {
if ((*ii)->id == (*i)->id()) {
#include "pbd/pathscanner.h"
#include "pbd/locale_guard.h"
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
AudioEngine::~AudioEngine ()
{
{
- Glib::Mutex::Lock tm (_process_lock);
+ Glib::Threads::Mutex::Lock tm (_process_lock);
session_removed.signal ();
if (_running) {
AudioEngine::process_callback (pframes_t nframes)
{
GET_PRIVATE_JACK_POINTER_RET(_jack,0);
- Glib::Mutex::Lock tm (_process_lock, Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock tm (_process_lock, Glib::Threads::TRY_LOCK);
PT_TIMING_REF;
PT_TIMING_CHECK (1);
}
{
- Glib::Mutex::Lock lm (_process_lock);
+ Glib::Threads::Mutex::Lock lm (_process_lock);
boost::shared_ptr<Ports> p = ports.reader();
{
if (m_meter_thread == 0) {
g_atomic_int_set (&m_meter_exit, 0);
- m_meter_thread = Glib::Thread::create (boost::bind (&AudioEngine::meter_thread, this),
- 500000, true, true, Glib::THREAD_PRIORITY_NORMAL);
+ m_meter_thread = Glib::Threads::Thread::create (boost::bind (&AudioEngine::meter_thread, this));
}
}
void
AudioEngine::set_session (Session *s)
{
- Glib::Mutex::Lock pl (_process_lock);
+ Glib::Threads::Mutex::Lock pl (_process_lock);
SessionHandlePtr::set_session (s);
void
AudioEngine::remove_session ()
{
- Glib::Mutex::Lock lm (_process_lock);
+ Glib::Threads::Mutex::Lock lm (_process_lock);
if (_running) {
}
{
- Glib::Mutex::Lock lm (_process_lock);
+ Glib::Threads::Mutex::Lock lm (_process_lock);
jack_client_close (_priv_jack);
_jack = 0;
}
#include <glibmm/miscutils.h>
#include <glibmm/fileutils.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/audiofilesource.h"
#include "ardour/debug.h"
}
};
-Glib::StaticPrivate<SizedSampleBuffer> thread_interleave_buffer = GLIBMM_STATIC_PRIVATE_INIT;
+Glib::Threads::Private<SizedSampleBuffer> thread_interleave_buffer;
/** Constructor used for existing external-to-session files. */
AudioFileSource::AudioFileSource (Session& s, const string& path, Source::Flag flags)
#include <boost/scoped_array.hpp>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/basename.h"
#include "pbd/xml++.h"
using namespace ARDOUR;
using namespace PBD;
-Glib::StaticMutex AudioSource::_level_buffer_lock = GLIBMM_STATIC_MUTEX_INIT;
+Glib::Threads::Mutex AudioSource::_level_buffer_lock;
vector<boost::shared_ptr<Sample> > AudioSource::_mixdown_buffers;
vector<boost::shared_ptr<gain_t> > AudioSource::_gain_buffers;
size_t AudioSource::_working_buffers_size = 0;
AudioSource::peaks_ready (boost::function<void()> doThisWhenReady, ScopedConnection** connect_here_if_not, EventLoop* event_loop) const
{
bool ret;
- Glib::Mutex::Lock lm (_peaks_ready_lock);
+ Glib::Threads::Mutex::Lock lm (_peaks_ready_lock);
if (!(ret = _peaks_built)) {
*connect_here_if_not = new ScopedConnection;
{
assert (cnt >= 0);
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
return read_unlocked (dst, start, cnt);
}
framecnt_t
AudioSource::write (Sample *dst, framecnt_t cnt)
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
/* any write makes the fill not removable */
_flags = Flag (_flags & ~Removable);
return write_unlocked (dst, cnt);
AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t start, framecnt_t cnt,
double samples_per_visual_peak, framecnt_t samples_per_file_peak) const
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
double scale;
double expected_peaks;
PeakData::PeakDatum xmax;
{
/* hold lock while building peaks */
- Glib::Mutex::Lock lp (_lock);
+ Glib::Threads::Mutex::Lock lp (_lock);
if (prepare_for_peakfile_writes ()) {
goto out;
}
if (done) {
- Glib::Mutex::Lock lm (_peaks_ready_lock);
+ Glib::Threads::Mutex::Lock lm (_peaks_ready_lock);
_peaks_built = true;
PeaksReady (); /* EMIT SIGNAL */
}
_peak_byte_max = max (_peak_byte_max, (off_t) (byte + sizeof(PeakData)));
{
- Glib::Mutex::Lock lm (_peaks_ready_lock);
+ Glib::Threads::Mutex::Lock lm (_peaks_ready_lock);
PeakRangeReady (peak_leftover_frame, peak_leftover_cnt); /* EMIT SIGNAL */
if (intermediate_peaks_ready) {
PeaksReady (); /* EMIT SIGNAL */
_peak_byte_max = max (_peak_byte_max, (off_t) (first_peak_byte + sizeof(PeakData)*peaks_computed));
if (frames_done) {
- Glib::Mutex::Lock lm (_peaks_ready_lock);
+ Glib::Threads::Mutex::Lock lm (_peaks_ready_lock);
PeakRangeReady (first_frame, frames_done); /* EMIT SIGNAL */
if (intermediate_peaks_ready) {
PeaksReady (); /* EMIT SIGNAL */
void
AudioSource::mark_streaming_write_completed ()
{
- Glib::Mutex::Lock lm (_peaks_ready_lock);
+ Glib::Threads::Mutex::Lock lm (_peaks_ready_lock);
if (_peaks_built) {
PeaksReady (); /* EMIT SIGNAL */
void
AudioSource::allocate_working_buffers (framecnt_t framerate)
{
- Glib::Mutex::Lock lm (_level_buffer_lock);
+ Glib::Threads::Mutex::Lock lm (_level_buffer_lock);
/* Note: we don't need any buffers allocated until
void
AudioSource::ensure_buffers_for_level (uint32_t level, framecnt_t frame_rate)
{
- Glib::Mutex::Lock lm (_level_buffer_lock);
+ Glib::Threads::Mutex::Lock lm (_level_buffer_lock);
ensure_buffers_for_level_locked (level, frame_rate);
}
*/
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/error.h"
return;
}
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
/* copy it */
ProcessorStreams ps;
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (configure_processors (&ps)) {
error << string_compose (_("Cannot setup auditioner processing flow for %1 channels"),
ARDOUR::ChanCount
ARDOUR::AutoBundle::nchannels () const
{
- Glib::Mutex::Lock lm (_ports_mutex);
+ Glib::Threads::Mutex::Lock lm (_ports_mutex);
return ChanCount (type(), _ports.size ());
}
{
assert (c < nchannels().get (type()));
- Glib::Mutex::Lock lm (_ports_mutex);
+ Glib::Threads::Mutex::Lock lm (_ports_mutex);
return _ports[c];
}
void
ARDOUR::AutoBundle::set_channels (uint32_t n)
{
- Glib::Mutex::Lock lm (_ports_mutex);
+ Glib::Threads::Mutex::Lock lm (_ports_mutex);
_ports.resize (n);
}
{
assert (c < nchannels ().get (type()));
- Glib::Mutex::Lock lm (_ports_mutex);
+ Glib::Threads::Mutex::Lock lm (_ports_mutex);
_ports[c].resize (1);
_ports[c][0] = p;
}
: ControlSet (other)
, _a_session (other._a_session)
{
- Glib::Mutex::Lock lm (other._control_lock);
+ Glib::Threads::Mutex::Lock lm (other._control_lock);
for (Controls::const_iterator i = other._controls.begin(); i != other._controls.end(); ++i) {
boost::shared_ptr<Evoral::Control> ac (control_factory (i->first));
Automatable::~Automatable ()
{
{
- Glib::Mutex::Lock lm (_control_lock);
+ Glib::Threads::Mutex::Lock lm (_control_lock);
for (Controls::const_iterator li = _controls.begin(); li != _controls.end(); ++li) {
boost::dynamic_pointer_cast<AutomationControl>(li->second)->drop_references ();
return 1;
}
- Glib::Mutex::Lock lm (control_lock());
+ Glib::Threads::Mutex::Lock lm (control_lock());
set<Evoral::Parameter> tosave;
controls().clear ();
int
Automatable::set_automation_xml_state (const XMLNode& node, Evoral::Parameter legacy_param)
{
- Glib::Mutex::Lock lm (control_lock());
+ Glib::Threads::Mutex::Lock lm (control_lock());
/* Don't clear controls, since some may be special derived Controllable classes */
XMLNode&
Automatable::get_automation_xml_state ()
{
- Glib::Mutex::Lock lm (control_lock());
+ Glib::Threads::Mutex::Lock lm (control_lock());
XMLNode* node = new XMLNode (Automatable::xml_node_name);
if (controls().empty()) {
void
Automatable::set_parameter_automation_state (Evoral::Parameter param, AutoState s)
{
- Glib::Mutex::Lock lm (control_lock());
+ Glib::Threads::Mutex::Lock lm (control_lock());
boost::shared_ptr<AutomationControl> c = automation_control (param, true);
void
Automatable::set_parameter_automation_style (Evoral::Parameter param, AutoStyle s)
{
- Glib::Mutex::Lock lm (control_lock());
+ Glib::Threads::Mutex::Lock lm (control_lock());
boost::shared_ptr<AutomationControl> c = automation_control(param, true);
AutoStyle
Automatable::get_parameter_automation_style (Evoral::Parameter param)
{
- Glib::Mutex::Lock lm (control_lock());
+ Glib::Threads::Mutex::Lock lm (control_lock());
boost::shared_ptr<Evoral::Control> c = control(param);
boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(c->list());
_thread = 0;
}
- Glib::Mutex::Lock lm (automation_watch_lock);
+ Glib::Threads::Mutex::Lock lm (automation_watch_lock);
automation_watches.clear ();
}
void
AutomationWatch::add_automation_watch (boost::shared_ptr<AutomationControl> ac)
{
- Glib::Mutex::Lock lm (automation_watch_lock);
+ Glib::Threads::Mutex::Lock lm (automation_watch_lock);
DEBUG_TRACE (DEBUG::Automation, string_compose ("now watching control %1 for automation\n", ac->name()));
automation_watches.push_back (ac);
void
AutomationWatch::remove_automation_watch (boost::shared_ptr<AutomationControl> ac)
{
- Glib::Mutex::Lock lm (automation_watch_lock);
+ Glib::Threads::Mutex::Lock lm (automation_watch_lock);
DEBUG_TRACE (DEBUG::Automation, string_compose ("remove control %1 from automation watch\n", ac->name()));
automation_watches.remove (ac);
ac->list()->set_in_write_pass (false);
}
{
- Glib::Mutex::Lock lm (automation_watch_lock);
+ Glib::Threads::Mutex::Lock lm (automation_watch_lock);
framepos_t time = _session->audible_frame ();
if (_session) {
_run_thread = true;
- _thread = Glib::Thread::create (boost::bind (&AutomationWatch::thread, this),
- 500000, true, true, Glib::THREAD_PRIORITY_NORMAL);
+ _thread = Glib::Threads::Thread::create (boost::bind (&AutomationWatch::thread, this));
_session->TransportStateChange.connect_same_thread (transport_connection, boost::bind (&AutomationWatch::transport_state_change, this));
}
bool rolling = _session->transport_rolling();
{
- Glib::Mutex::Lock lm (automation_watch_lock);
+ Glib::Threads::Mutex::Lock lm (automation_watch_lock);
for (AutomationWatches::iterator aw = automation_watches.begin(); aw != automation_watches.end(); ++aw) {
DEBUG_TRACE (DEBUG::Automation, string_compose ("%1: transport state changed, speed %2, in write pass ? %3 writing ? %4\n",
RingBufferNPT<ThreadBuffers*>* BufferManager::thread_buffers = 0;
std::list<ThreadBuffers*>* BufferManager::thread_buffers_list = 0;
-Glib::StaticMutex BufferManager::rb_mutex = GLIBMM_STATIC_MUTEX_INIT;
+Glib::Threads::Mutex BufferManager::rb_mutex;
using std::cerr;
using std::endl;
ThreadBuffers*
BufferManager::get_thread_buffers ()
{
- Glib::Mutex::Lock em (rb_mutex);
+ Glib::Threads::Mutex::Lock em (rb_mutex);
ThreadBuffers* tbp;
if (thread_buffers->read (&tbp, 1) == 1) {
void
BufferManager::put_thread_buffers (ThreadBuffers* tbp)
{
- Glib::Mutex::Lock em (rb_mutex);
+ Glib::Threads::Mutex::Lock em (rb_mutex);
thread_buffers->write (&tbp, 1);
// cerr << "Put back thread buffers, readable count now " << thread_buffers->read_space() << endl;
}
ChanCount
Bundle::nchannels () const
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
ChanCount c;
for (vector<Channel>::const_iterator i = _channel.begin(); i != _channel.end(); ++i) {
{
assert (c < nchannels().n_total());
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
return _channel[c].ports;
}
assert (portname.find_first_of (':') != string::npos);
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel[ch].ports.push_back (portname);
}
bool changed = false;
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
PortList& pl = _channel[ch].ports;
PortList::iterator i = find (pl.begin(), pl.end(), portname);
assert (portname.find_first_of (':') != string::npos);
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel[ch].ports.clear ();
_channel[ch].ports.push_back (portname);
}
Bundle::add_channel (std::string const & n, DataType t)
{
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel.push_back (Channel (n, t));
}
Bundle::add_channel (std::string const & n, DataType t, PortList p)
{
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel.push_back (Channel (n, t, p));
}
Bundle::add_channel (std::string const & n, DataType t, std::string const & p)
{
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel.push_back (Channel (n, t, p));
}
{
assert (ch < nchannels().n_total());
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
return (std::find (_channel[ch].ports.begin (), _channel[ch].ports.end (), portname) != _channel[ch].ports.end ());
}
{
assert (ch < nchannels().n_total());
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel.erase (_channel.begin () + ch);
}
void
Bundle::remove_channels ()
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel.clear ();
}
bool
Bundle::offers_port (std::string p) const
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
for (std::vector<Channel>::const_iterator i = _channel.begin(); i != _channel.end(); ++i) {
for (PortList::const_iterator j = i->ports.begin(); j != i->ports.end(); ++j) {
bool
Bundle::offers_port_alone (std::string p) const
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
for (std::vector<Channel>::const_iterator i = _channel.begin(); i != _channel.end(); ++i) {
if (i->ports.size() == 1 && i->ports[0] == p) {
{
assert (ch < nchannels().n_total());
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
return _channel[ch].name;
}
assert (ch < nchannels().n_total());
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel[ch].name = n;
}
Bundle::remove_ports_from_channels ()
{
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
for (uint32_t c = 0; c < _channel.size(); ++c) {
_channel[c].ports.clear ();
}
assert (ch < nchannels().n_total());
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
_channel[ch].ports.clear ();
}
{
assert (c < nchannels().n_total());
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
return _channel[c].type;
}
return c;
}
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
vector<Channel>::const_iterator i = _channel.begin ();
return c;
}
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
uint32_t s = 0;
{
- Glib::Mutex::Lock lm (request_lock);
+ Glib::Threads::Mutex::Lock lm (request_lock);
if (should_run && (disk_work_outstanding || transport_work_requested())) {
// for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
void
Butler::stop ()
{
- Glib::Mutex::Lock lm (request_lock);
+ Glib::Threads::Mutex::Lock lm (request_lock);
char c = Request::Pause;
(void) ::write (request_pipe[1], &c, 1);
paused.wait(request_lock);
void
Butler::wait_until_finished ()
{
- Glib::Mutex::Lock lm (request_lock);
+ Glib::Threads::Mutex::Lock lm (request_lock);
char c = Request::Pause;
(void) ::write (request_pipe[1], &c, 1);
paused.wait(request_lock);
ControlProtocolManager::~ControlProtocolManager()
{
- Glib::Mutex::Lock lm (protocols_lock);
+ Glib::Threads::Mutex::Lock lm (protocols_lock);
for (list<ControlProtocol*>::iterator i = control_protocols.begin(); i != control_protocols.end(); ++i) {
delete (*i);
SessionHandlePtr::set_session (s);
if (_session) {
- Glib::Mutex::Lock lm (protocols_lock);
+ Glib::Threads::Mutex::Lock lm (protocols_lock);
for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
if ((*i)->requested || (*i)->mandatory) {
SessionHandlePtr::session_going_away ();
{
- Glib::Mutex::Lock lm (protocols_lock);
+ Glib::Threads::Mutex::Lock lm (protocols_lock);
for (list<ControlProtocol*>::iterator p = control_protocols.begin(); p != control_protocols.end(); ++p) {
delete *p;
cpi.descriptor->destroy (cpi.descriptor, cpi.protocol);
{
- Glib::Mutex::Lock lm (protocols_lock);
+ Glib::Threads::Mutex::Lock lm (protocols_lock);
list<ControlProtocol*>::iterator p = find (control_protocols.begin(), control_protocols.end(), cpi.protocol);
if (p != control_protocols.end()) {
control_protocols.erase (p);
return;
}
- Glib::Mutex::Lock lm (protocols_lock);
+ Glib::Threads::Mutex::Lock lm (protocols_lock);
for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
if ((*i)->mandatory && ((*i)->protocol == 0)) {
XMLNodeConstIterator citer;
XMLProperty* prop;
- Glib::Mutex::Lock lm (protocols_lock);
+ Glib::Threads::Mutex::Lock lm (protocols_lock);
clist = node.children();
ControlProtocolManager::get_state ()
{
XMLNode* root = new XMLNode (state_node_name);
- Glib::Mutex::Lock lm (protocols_lock);
+ Glib::Threads::Mutex::Lock lm (protocols_lock);
for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
void
ControlProtocolManager::midi_connectivity_established ()
{
- Glib::Mutex::Lock lm (protocols_lock);
+ Glib::Threads::Mutex::Lock lm (protocols_lock);
for (list<ControlProtocol*>::iterator p = control_protocols.begin(); p != control_protocols.end(); ++p) {
(*p)->midi_connectivity_established ();
#include <sys/stat.h>
#include <sys/mman.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/error.h"
#include "pbd/basename.h"
void
Diskstream::handle_input_change (IOChange change, void * /*src*/)
{
- Glib::Mutex::Lock lm (state_lock);
+ Glib::Threads::Mutex::Lock lm (state_lock);
if (change.type & (IOChange::ConfigurationChanged|IOChange::ConnectionsChanged)) {
{
if (_buffer_reallocation_required)
{
- Glib::Mutex::Lock lm (state_lock);
+ Glib::Threads::Mutex::Lock lm (state_lock);
allocate_temporary_buffers ();
_buffer_reallocation_required = false;
ARDOUR::framepos_t
Diskstream::get_capture_start_frame (uint32_t n) const
{
- Glib::Mutex::Lock lm (capture_info_lock);
+ Glib::Threads::Mutex::Lock lm (capture_info_lock);
if (capture_info.size() > n) {
/* this is a completed capture */
ARDOUR::framecnt_t
Diskstream::get_captured_frames (uint32_t n) const
{
- Glib::Mutex::Lock lm (capture_info_lock);
+ Glib::Threads::Mutex::Lock lm (capture_info_lock);
if (capture_info.size() > n) {
/* this is a completed capture */
bool prior_playlist = false;
{
- Glib::Mutex::Lock lm (state_lock);
+ Glib::Threads::Mutex::Lock lm (state_lock);
if (playlist == _playlist) {
return 0;
#include <glibmm/miscutils.h>
#include <glibmm/fileutils.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/data_type.h"
#include "ardour/file_source.h"
int
FileSource::set_source_name (const string& newname, bool destructive)
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
string oldpath = _path;
string newpath = _session.change_source_path_by_name (oldpath, _name, newname, destructive);
return;
}
- Glib::Mutex::Lock lm (_session.engine().process_lock());
+ Glib::Threads::Mutex::Lock lm (_session.engine().process_lock());
pthread_t a_thread;
if (!_thread_list.empty()) {
void
Graph::clear_other_chain ()
{
- Glib::Mutex::Lock ls (_swap_mutex);
+ Glib::Threads::Mutex::Lock ls (_swap_mutex);
while (1) {
if (_setup_chain != _pending_chain) {
void
Graph::rechain (boost::shared_ptr<RouteList> routelist, GraphEdges const & edges)
{
- Glib::Mutex::Lock ls (_swap_mutex);
+ Glib::Threads::Mutex::Lock ls (_swap_mutex);
int chain = _setup_chain;
DEBUG_TRACE (DEBUG::Graph, string_compose ("============== setup %1\n", chain));
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/internal_return.h"
#include "ardour/internal_send.h"
return;
}
- Glib::Mutex::Lock lm (_sends_mutex, Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock lm (_sends_mutex, Glib::Threads::TRY_LOCK);
if (lm.locked ()) {
for (list<InternalSend*>::iterator i = _sends.begin(); i != _sends.end(); ++i) {
void
InternalReturn::add_send (InternalSend* send)
{
- Glib::Mutex::Lock lm (_sends_mutex);
+ Glib::Threads::Mutex::Lock lm (_sends_mutex);
_sends.push_back (send);
}
void
InternalReturn::remove_send (InternalSend* send)
{
- Glib::Mutex::Lock lm (_sends_mutex);
+ Glib::Threads::Mutex::Lock lm (_sends_mutex);
_sends.remove (send);
}
#include <errno.h>
#include <glibmm.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/xml++.h"
#include "pbd/replace_all.h"
#include "i18n.h"
-#define BLOCK_PROCESS_CALLBACK() Glib::Mutex::Lock em (AudioEngine::instance()->process_lock())
+#define BLOCK_PROCESS_CALLBACK() Glib::Threads::Mutex::Lock em (AudioEngine::instance()->process_lock())
using namespace std;
using namespace ARDOUR;
IO::~IO ()
{
- Glib::Mutex::Lock lm (io_lock);
+ Glib::Threads::Mutex::Lock lm (io_lock);
BLOCK_PROCESS_CALLBACK ();
we assume that its safely locked by our own ::disconnect().
*/
- Glib::Mutex::Lock tm (io_lock, Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock tm (io_lock, Glib::Threads::TRY_LOCK);
if (tm.locked()) {
/* we took the lock, so we cannot be here from inside
}
{
- Glib::Mutex::Lock lm (io_lock);
+ Glib::Threads::Mutex::Lock lm (io_lock);
/* check that our_port is really one of ours */
}
{
- Glib::Mutex::Lock lm (io_lock);
+ Glib::Threads::Mutex::Lock lm (io_lock);
/* check that our_port is really one of ours */
BLOCK_PROCESS_CALLBACK ();
{
- Glib::Mutex::Lock lm (io_lock);
+ Glib::Threads::Mutex::Lock lm (io_lock);
if (_ports.remove(port)) {
change.type = IOChange::Type (change.type | IOChange::ConfigurationChanged);
{
- Glib::Mutex::Lock lm (io_lock);
+ Glib::Threads::Mutex::Lock lm (io_lock);
/* Create a new port */
IO::disconnect (void* src)
{
{
- Glib::Mutex::Lock lm (io_lock);
+ Glib::Threads::Mutex::Lock lm (io_lock);
for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) {
i->disconnect_all ();
change.before = _ports.count ();
{
- Glib::Mutex::Lock im (io_lock);
+ Glib::Threads::Mutex::Lock im (io_lock);
if (ensure_ports_locked (count, clear, changed)) {
return -1;
}
vector<string>::iterator ci;
int n;
LocaleGuard lg (X_("POSIX"));
- Glib::Mutex::Lock lm (io_lock);
+ Glib::Threads::Mutex::Lock lm (io_lock);
node->add_property("name", _name);
id().print (buf, sizeof (buf));
get_port_counts (node, version, n, c);
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (ensure_ports (n, true, this)) {
error << string_compose(_("%1: cannot create I/O ports"), _name) << endmsg;
}
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
// FIXME: audio-only
if (ensure_ports (ChanCount(DataType::AUDIO, nports), true, this)) {
BLOCK_PROCESS_CALLBACK ();
{
- Glib::Mutex::Lock lm2 (io_lock);
+ Glib::Threads::Mutex::Lock lm2 (io_lock);
c->connect (_bundle, _session.engine());
BLOCK_PROCESS_CALLBACK ();
{
- Glib::Mutex::Lock lm2 (io_lock);
+ Glib::Threads::Mutex::Lock lm2 (io_lock);
c->disconnect (_bundle, _session.engine());
int
IO::enable_connecting ()
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock());
connecting_legal = true;
boost::optional<int> r = ConnectingLegal ();
return r.get_value_or (0);
bool
IO::has_port (boost::shared_ptr<Port> p) const
{
- Glib::Mutex::Lock lm (io_lock);
+ Glib::Threads::Mutex::Lock lm (io_lock);
return _ports.contains (p);
}
int ret;
if (want_lock) {
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
ret = set_current_unlocked (loc);
} else {
ret = set_current_unlocked (loc);
Locations::clear ()
{
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
Locations::clear_markers ()
{
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
LocationList::iterator tmp;
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
Locations::clear_ranges ()
{
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
LocationList::iterator tmp;
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
assert (loc);
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
locations.push_back (loc);
if (make_current) {
}
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (i = locations.begin(); i != locations.end(); ++i) {
if ((*i) == loc) {
{
XMLNode *node = new XMLNode ("Locations");
LocationList::iterator iter;
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (iter = locations.begin(); iter != locations.end(); ++iter) {
node->add_child_nocopy ((*iter)->get_state ());
}
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
XMLNodeConstIterator niter;
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
LocationList locs;
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
locs = locations;
}
LocationList locs;
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
locs = locations;
}
LocationList locs;
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
locs = locations;
}
Locations::num_range_markers () const
{
uint32_t cnt = 0;
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
if ((*i)->is_range_marker()) {
++cnt;
void
Locations::find_all_between (framepos_t start, framepos_t end, LocationList& ll, Location::Flags flags)
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
if ((flags == 0 || (*i)->matches (flags)) &&
#include "pbd/error.h"
#include "pbd/basename.h"
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/xml++.h"
#include "pbd/memento_command.h"
#include "pbd/enumwriter.h"
MidiDiskstream::~MidiDiskstream ()
{
- Glib::Mutex::Lock lm (state_lock);
+ Glib::Threads::Mutex::Lock lm (state_lock);
}
MidiDiskstream::non_realtime_input_change ()
{
{
- Glib::Mutex::Lock lm (state_lock);
+ Glib::Threads::Mutex::Lock lm (state_lock);
if (input_change_pending.type == IOChange::NoChange) {
return;
return 1;
}
- Glib::Mutex::Lock sm (state_lock, Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock sm (state_lock, Glib::Threads::TRY_LOCK);
if (!sm.locked()) {
return 1;
}
if (buf.size() != 0) {
- Glib::Mutex::Lock lm (_gui_feed_buffer_mutex, Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock lm (_gui_feed_buffer_mutex, Glib::Threads::TRY_LOCK);
if (lm.locked ()) {
/* Copy this data into our GUI feed buffer and tell the GUI
int
MidiDiskstream::seek (framepos_t frame, bool complete_refill)
{
- Glib::Mutex::Lock lm (state_lock);
+ Glib::Threads::Mutex::Lock lm (state_lock);
int ret = -1;
if (g_atomic_int_get (&_frames_read_from_ringbuffer) == 0) {
}
/* XXX is there anything we can do if err != 0 ? */
- Glib::Mutex::Lock lm (capture_info_lock);
+ Glib::Threads::Mutex::Lock lm (capture_info_lock);
if (capture_info.empty()) {
goto no_capture_stuff_to_do;
{
boost::shared_ptr<MidiBuffer> b (new MidiBuffer (AudioEngine::instance()->raw_buffer_size (DataType::MIDI)));
- Glib::Mutex::Lock lm (_gui_feed_buffer_mutex);
+ Glib::Threads::Mutex::Lock lm (_gui_feed_buffer_mutex);
b->copy (_gui_feed_buffer);
return b;
}
boost::shared_ptr<MidiSource> ms = _midi_source.lock ();
assert (ms);
- Glib::Mutex::Lock* source_lock = new Glib::Mutex::Lock (ms->mutex());
+ Glib::Threads::Mutex::Lock* source_lock = new Glib::Threads::Mutex::Lock (ms->mutex());
ms->invalidate(); // Release cached iterator's read lock on model
return WriteLock(new WriteLockImpl(source_lock, _lock, _control_lock));
}
void
MidiModel::source_interpolation_changed (Evoral::Parameter p, Evoral::ControlList::InterpolationStyle s)
{
- Glib::Mutex::Lock lm (_control_lock);
+ Glib::Threads::Mutex::Lock lm (_control_lock);
control(p)->list()->set_interpolation (s);
}
void
MidiModel::source_automation_state_changed (Evoral::Parameter p, AutoState s)
{
- Glib::Mutex::Lock lm (_control_lock);
+ Glib::Threads::Mutex::Lock lm (_control_lock);
boost::shared_ptr<AutomationList> al = boost::dynamic_pointer_cast<AutomationList> (control(p)->list ());
al->set_automation_state (s);
}
#include <set>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/xml++.h"
#include "pbd/basename.h"
for a given set of filtered_parameters, so now that we've changed that list we must invalidate
the iterator.
*/
- Glib::Mutex::Lock lm (midi_source(0)->mutex());
+ Glib::Threads::Mutex::Lock lm (midi_source(0)->mutex());
midi_source(0)->invalidate ();
}
MidiStateTracker* tracker,
std::set<Evoral::Parameter> const & filtered) const
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
BeatsFramesConverter converter(_session.tempo_map(), source_start);
framecnt_t
MidiSource::midi_write (MidiRingBuffer<framepos_t>& source, framepos_t source_start, framecnt_t duration)
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
const framecnt_t ret = write_unlocked (source, source_start, duration);
boost::shared_ptr<MidiSource> new_src = boost::dynamic_pointer_cast<MidiSource>(nsrcs[0]);
assert(new_src);
- Glib::Mutex::Lock sl (new_src->mutex ());
+ Glib::Threads::Mutex::Lock sl (new_src->mutex ());
new_src->load_model(false, true);
boost::shared_ptr<MidiModel> new_model = new_src->model();
int
MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler)
{
- Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
return 0;
}
void
MidiTrack::realtime_locate ()
{
- Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked ()) {
return;
void
MidiTrack::realtime_handle_transport_stopped ()
{
- Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked ()) {
return;
void
MTC_Slave::queue_reset (bool reset_pos)
{
- Glib::Mutex::Lock lm (reset_lock);
+ Glib::Threads::Mutex::Lock lm (reset_lock);
reset_pending++;
if (reset_pos) {
reset_position = true;
void
MTC_Slave::maybe_reset ()
{
- Glib::Mutex::Lock lm (reset_lock);
+ Glib::Threads::Mutex::Lock lm (reset_lock);
if (reset_pending) {
reset (reset_position);
framepos_t end = now + nframes;
framecnt_t offset = 0;
- Glib::Mutex::Lock lm (control_lock(), Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock lm (control_lock(), Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
connect_and_run (bufs, nframes, offset, false);
using namespace Glib;
using namespace std;
-Private<ThreadBuffers>* ProcessThread::_private_thread_buffers = 0;
-
static void
release_thread_buffer (void* arg)
{
BufferManager::put_thread_buffers ((ThreadBuffers*) arg);
}
+Glib::Threads::Private<ThreadBuffers> ProcessThread::_private_thread_buffers (release_thread_buffer);
+
void
ProcessThread::init ()
{
- if (_private_thread_buffers == 0) {
- _private_thread_buffers = new Private<ThreadBuffers> (release_thread_buffer);
- }
}
ProcessThread::ProcessThread ()
ThreadBuffers* tb = BufferManager::get_thread_buffers ();
assert (tb);
- _private_thread_buffers->set (tb);
+ _private_thread_buffers.set (tb);
}
void
ProcessThread::drop_buffers ()
{
- ThreadBuffers* tb = _private_thread_buffers->get();
+ ThreadBuffers* tb = _private_thread_buffers.get();
assert (tb);
BufferManager::put_thread_buffers (tb);
- _private_thread_buffers->set (0);
+ _private_thread_buffers.set (0);
}
BufferSet&
ProcessThread::get_silent_buffers (ChanCount count)
{
- ThreadBuffers* tb = _private_thread_buffers->get();
+ ThreadBuffers* tb = _private_thread_buffers.get();
assert (tb);
BufferSet* sb = tb->silent_buffers;
BufferSet&
ProcessThread::get_scratch_buffers (ChanCount count)
{
- ThreadBuffers* tb = _private_thread_buffers->get();
+ ThreadBuffers* tb = _private_thread_buffers.get();
assert (tb);
BufferSet* sb = tb->scratch_buffers;
BufferSet&
ProcessThread::get_mix_buffers (ChanCount count)
{
- ThreadBuffers* tb = _private_thread_buffers->get();
+ ThreadBuffers* tb = _private_thread_buffers.get();
assert (tb);
BufferSet* mb = tb->mix_buffers;
gain_t*
ProcessThread::gain_automation_buffer()
{
- ThreadBuffers* tb = _private_thread_buffers->get();
+ ThreadBuffers* tb = _private_thread_buffers.get();
assert (tb);
gain_t *g = tb->gain_automation_buffer;
gain_t*
ProcessThread::send_gain_automation_buffer()
{
- ThreadBuffers* tb = _private_thread_buffers->get();
+ ThreadBuffers* tb = _private_thread_buffers.get();
assert (tb);
gain_t* g = tb->send_gain_automation_buffer;
pan_t**
ProcessThread::pan_automation_buffer()
{
- ThreadBuffers* tb = _private_thread_buffers->get();
+ ThreadBuffers* tb = _private_thread_buffers.get();
assert (tb);
pan_t** p = tb->pan_automation_buffer;
#include <algorithm>
#include <sstream>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/xml++.h"
#include "ardour/debug.h"
using namespace std;
PBD::Signal1<void,boost::shared_ptr<Region> > RegionFactory::CheckNewRegion;
-Glib::StaticMutex RegionFactory::region_map_lock;
+Glib::Threads::Mutex RegionFactory::region_map_lock;
RegionFactory::RegionMap RegionFactory::region_map;
PBD::ScopedConnectionList* RegionFactory::region_list_connections = 0;
-Glib::StaticMutex RegionFactory::region_name_maps_mutex;
+Glib::Threads::Mutex RegionFactory::region_name_maps_mutex;
std::map<std::string, uint32_t> RegionFactory::region_name_number_map;
std::map<std::string, PBD::ID> RegionFactory::region_name_map;
RegionFactory::CompoundAssociations RegionFactory::_compound_associations;
p.second = r;
{
- Glib::Mutex::Lock lm (region_map_lock);
+ Glib::Threads::Mutex::Lock lm (region_map_lock);
region_map.insert (p);
}
return;
}
- Glib::Mutex::Lock lm (region_map_lock);
+ Glib::Threads::Mutex::Lock lm (region_map_lock);
RegionMap::iterator i = region_map.find (r->id());
if (i != region_map.end()) {
}
{
- Glib::Mutex::Lock lm (region_map_lock);
+ Glib::Threads::Mutex::Lock lm (region_map_lock);
region_map.clear ();
_compound_associations.clear ();
region_name_map.clear ();
/* copy region list */
{
- Glib::Mutex::Lock lm (region_map_lock);
+ Glib::Threads::Mutex::Lock lm (region_map_lock);
copy = region_map;
}
uint32_t
RegionFactory::nregions ()
{
- Glib::Mutex::Lock lm (region_map_lock);
+ Glib::Threads::Mutex::Lock lm (region_map_lock);
return region_map.size ();
}
{
update_region_name_number_map (region);
- Glib::Mutex::Lock lm (region_name_maps_mutex);
+ Glib::Threads::Mutex::Lock lm (region_name_maps_mutex);
region_name_map[region->name()] = region->id ();
}
{
update_region_name_number_map (region);
- Glib::Mutex::Lock lm (region_name_maps_mutex);
+ Glib::Threads::Mutex::Lock lm (region_name_maps_mutex);
map<string, PBD::ID>::iterator i = region_name_map.begin();
while (i != region_name_map.end() && i->second != region->id ()) {
which is just fine
*/
- Glib::Mutex::Lock lm (region_name_maps_mutex);
+ Glib::Threads::Mutex::Lock lm (region_name_maps_mutex);
region_name_number_map[base] = atoi (number.c_str ());
}
}
}
{
- Glib::Mutex::Lock lm (region_name_maps_mutex);
+ Glib::Threads::Mutex::Lock lm (region_name_maps_mutex);
map<string,uint32_t>::iterator x;
void
RegionFactory::get_regions_using_source (boost::shared_ptr<Source> s, std::set<boost::shared_ptr<Region> >& r)
{
- Glib::Mutex::Lock lm (region_map_lock);
+ Glib::Threads::Mutex::Lock lm (region_map_lock);
for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) {
if (i->second->uses_source (s)) {
void
RegionFactory::remove_regions_using_source (boost::shared_ptr<Source> src)
{
- Glib::Mutex::Lock lm (region_map_lock);
+ Glib::Threads::Mutex::Lock lm (region_map_lock);
RegionMap::iterator i = region_map.begin();
while (i != region_map.end()) {
void
RegionFactory::add_compound_association (boost::shared_ptr<Region> orig, boost::shared_ptr<Region> copy)
{
- Glib::Mutex::Lock lm (region_map_lock);
+ Glib::Threads::Mutex::Lock lm (region_map_lock);
_compound_associations[copy] = orig;
}
// Ensure there are enough buffers (since we add some)
if (_session.get_scratch_buffers(in).count() < out) {
- Glib::Mutex::Lock em (_session.engine().process_lock());
+ Glib::Threads::Mutex::Lock em (_session.engine().process_lock());
IO::PortCountChanged(out);
}
{
/* run a configure so that the invisible processors get set up */
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
configure_processors (0);
}
be half-destroyed by now
*/
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
(*i)->drop_references ();
}
boost::shared_ptr<Processor>
Route::before_processor_for_placement (Placement p)
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
ProcessorList::iterator loc;
return boost::shared_ptr<Processor> ();
}
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
ProcessorList::iterator i = _processors.begin ();
int j = 0;
}
{
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorState pstate (this);
boost::shared_ptr<PluginInsert> pi;
// configure redirect ports properly, etc.
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (configure_processors_unlocked (err)) {
pstate.restore ();
}
{
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorState pstate (this);
for (ProcessorList::const_iterator i = others.begin(); i != others.end(); ++i) {
}
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (configure_processors_unlocked (err)) {
pstate.restore ();
configure_processors_unlocked (0); // it worked before we tried to add it ...
void
Route::disable_processors (Placement p)
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
ProcessorList::iterator start, end;
placement_range(p, start, end);
void
Route::disable_processors ()
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
(*i)->deactivate ();
void
Route::disable_plugins (Placement p)
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
ProcessorList::iterator start, end;
placement_range(p, start, end);
void
Route::disable_plugins ()
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
if (boost::dynamic_pointer_cast<PluginInsert> (*i)) {
void
Route::ab_plugins (bool forward)
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
if (forward) {
}
{
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorList new_list;
ProcessorStreams err;
bool seen_amp = false;
_processors = new_list;
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
configure_processors_unlocked (&err); // this can't fail
}
}
processor_max_streams.reset();
{
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorState pstate (this);
ProcessorList::iterator i;
}
if (need_process_lock) {
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (configure_processors_unlocked (err)) {
pstate.restore ();
processor_max_streams.reset();
{
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorState pstate (this);
ProcessorList::iterator i;
_output->set_user_latency (0);
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (configure_processors_unlocked (err)) {
pstate.restore ();
assert (!AudioEngine::instance()->process_lock().trylock());
if (!_in_configure_processors) {
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
return configure_processors_unlocked (err);
}
list<pair<ChanCount, ChanCount> >
Route::try_configure_processors (ChanCount in, ProcessorStreams* err)
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
return try_configure_processors_unlocked (in, err);
}
void
Route::all_visible_processors_active (bool state)
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
if (_processors.empty()) {
return;
*/
{
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorState pstate (this);
ProcessorList::iterator oiter;
maybe_note_meter_position ();
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (configure_processors_unlocked (err)) {
pstate.restore ();
if ((prop = node.property (X_("processor-after-last-custom-meter"))) != 0) {
PBD::ID id (prop->value ());
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
ProcessorList::const_iterator i = _processors.begin ();
while (i != _processors.end() && (*i)->id() != id) {
++i;
}
{
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
_processors = new_order;
if (must_configure) {
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
configure_processors_unlocked (0);
}
void
Route::silence (framecnt_t nframes)
{
- Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
return;
}
void
Route::add_send_to_internal_return (InternalSend* send)
{
- Glib::RWLock::ReaderLock rm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock rm (_processor_lock);
for (ProcessorList::const_iterator x = _processors.begin(); x != _processors.end(); ++x) {
boost::shared_ptr<InternalReturn> d = boost::dynamic_pointer_cast<InternalReturn>(*x);
void
Route::remove_send_from_internal_return (InternalSend* send)
{
- Glib::RWLock::ReaderLock rm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock rm (_processor_lock);
for (ProcessorList::const_iterator x = _processors.begin(); x != _processors.end(); ++x) {
boost::shared_ptr<InternalReturn> d = boost::dynamic_pointer_cast<InternalReturn>(*x);
assert (route != _session.monitor_out ());
{
- Glib::RWLock::ReaderLock rm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock rm (_processor_lock);
for (ProcessorList::iterator x = _processors.begin(); x != _processors.end(); ++x) {
boost::shared_ptr<InternalSend> listener;
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
listener.reset (new InternalSend (_session, _pannable, _mute_master, route, Delivery::Aux));
}
ProcessorList::iterator tmp;
{
- Glib::RWLock::ReaderLock rl(_processor_lock);
+ Glib::Threads::RWLock::ReaderLock rl(_processor_lock);
/* have to do this early because otherwise processor reconfig
* will put _monitor_send back in the list
framepos_t now = _session.transport_frame();
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
Automatable::transport_stopped (now);
int
Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool session_state_changing)
{
- Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
return 0;
}
int
Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& /* need_butler */)
{
- Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
return 0;
}
this is called from the RT audio thread.
*/
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
(*i)->flush ();
bool meter_was_visible_to_user = _meter->display_to_user ();
{
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
maybe_note_meter_position ();
Route::listen_position_changed ()
{
{
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorState pstate (this);
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (configure_processors_unlocked (0)) {
pstate.restore ();
_capturing_processor->activate ();
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
configure_processors (0);
}
/* redirect automation */
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::iterator i = _processors.begin (); i != _processors.end (); ++i) {
set<Evoral::Parameter> parameters = (*i)->what_can_be_automated();
boost::shared_ptr<Send>
Route::internal_send_for (boost::shared_ptr<const Route> target) const
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
boost::shared_ptr<InternalSend> send;
void
Route::meter ()
{
- Glib::RWLock::ReaderLock rm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock rm (_processor_lock, Glib::Threads::TRY_LOCK);
assert (_meter);
/* maybe one of our processors does or ... */
- Glib::RWLock::ReaderLock rm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock rm (_processor_lock, Glib::Threads::TRY_LOCK);
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
if ((c = boost::dynamic_pointer_cast<AutomationControl>((*i)->control (param))) != 0) {
break;
boost::shared_ptr<Processor>
Route::nth_plugin (uint32_t n)
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
ProcessorList::iterator i;
for (i = _processors.begin(); i != _processors.end(); ++i) {
boost::shared_ptr<Processor>
Route::nth_send (uint32_t n)
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
ProcessorList::iterator i;
for (i = _processors.begin(); i != _processors.end(); ++i) {
bool
Route::has_io_processor_named (const string& name)
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
ProcessorList::iterator i;
for (i = _processors.begin(); i != _processors.end(); ++i) {
void
Route::set_processor_positions ()
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
bool had_amp = false;
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
{
list<string> p;
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
if (boost::dynamic_pointer_cast<UnknownProcessor const> (*i)) {
p.push_back ((*i)->name ());
Route::setup_invisible_processors ()
{
#ifndef NDEBUG
- Glib::RWLock::WriterLock lm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
assert (!lm.locked ());
#endif
void
Route::unpan ()
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
- Glib::RWLock::ReaderLock lp (_processor_lock);
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::RWLock::ReaderLock lp (_processor_lock);
_pannable.reset ();
boost::shared_ptr<Processor>
Route::processor_by_id (PBD::ID id) const
{
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
if ((*i)->id() == id) {
return *i;
boost::shared_ptr<Processor>
Route::the_instrument () const
{
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
if (boost::dynamic_pointer_cast<PluginInsert>(*i)) {
if ((*i)->input_streams().n_midi() > 0 &&
}
{
- Glib::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::WriterLock lm (_processor_lock);
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
(*i)->transport_located (pos);
#include <unistd.h>
#include <limits.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <glibmm/miscutils.h>
#include <glibmm/fileutils.h>
ControlProtocolManager::instance().midi_connectivity_established ();
if (_is_new && !no_auto_connect()) {
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock());
auto_connect_master_bus ();
}
* pieces of audio as we work on each route.
*/
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
/* Connect tracks to monitor section. Note that in an
existing session, the internal sends will already exist, but we want the
// boost_debug_shared_ptr_mark_interesting (r.get(), "Route");
#endif
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
r->input()->ensure_io (_master_out->output()->n_ports(), false, this);
r->output()->ensure_io (_master_out->output()->n_ports(), false, this);
}
* pieces of audio as we work on each route.
*/
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
/* Connect tracks to monitor section. Note that in an
existing session, the internal sends will already exist, but we want the
// boost_debug_shared_ptr_mark_interesting (track.get(), "Track");
#endif
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (track->input()->ensure_io (input, false, this)) {
error << "cannot configure " << input << " out configuration for new midi track" << endmsg;
goto failed;
return;
}
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock (), Glib::NOT_LOCK);
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock (), Glib::Threads::NOT_LOCK);
if (with_lock) {
lm.acquire ();
// boost_debug_shared_ptr_mark_interesting (track.get(), "Track");
#endif
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (track->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) {
error << string_compose (
// boost_debug_shared_ptr_mark_interesting (bus.get(), "Route");
#endif
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
if (bus->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) {
error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"),
loading this normally happens in a different way.
*/
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
IOChange change (IOChange::Type (IOChange::ConfigurationChanged | IOChange::ConnectionsChanged));
change.after = route->input()->n_ports();
if (_monitor_out && IO::connecting_legal) {
{
- Glib::Mutex::Lock lm (_engine.process_lock());
+ Glib::Threads::Mutex::Lock lm (_engine.process_lock());
for (RouteList::iterator x = new_routes.begin(); x != new_routes.end(); ++x) {
if ((*x)->is_monitor()) {
RegionFactory::RegionMap::const_iterator i;
boost::shared_ptr<Region> region;
- Glib::Mutex::Lock lm (region_lock);
+ Glib::Threads::Mutex::Lock lm (region_lock);
for (i = regions.begin(); i != regions.end(); ++i) {
for (list<boost::shared_ptr<Source> >::iterator s = srcs.begin(); s != srcs.end(); ) {
{
- Glib::Mutex::Lock ls (source_lock);
+ Glib::Threads::Mutex::Lock ls (source_lock);
/* remove from the main source list */
sources.erase ((*s)->id());
}
entry.second = source;
{
- Glib::Mutex::Lock lm (source_lock);
+ Glib::Threads::Mutex::Lock lm (source_lock);
result = sources.insert (entry);
}
}
{
- Glib::Mutex::Lock lm (source_lock);
+ Glib::Threads::Mutex::Lock lm (source_lock);
if ((i = sources.find (source->id())) != sources.end()) {
sources.erase (i);
boost::shared_ptr<Source>
Session::source_by_id (const PBD::ID& id)
{
- Glib::Mutex::Lock lm (source_lock);
+ Glib::Threads::Mutex::Lock lm (source_lock);
SourceMap::iterator i;
boost::shared_ptr<Source> source;
boost::shared_ptr<Source>
Session::source_by_path_and_channel (const string& path, uint16_t chn)
{
- Glib::Mutex::Lock lm (source_lock);
+ Glib::Threads::Mutex::Lock lm (source_lock);
for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) {
boost::shared_ptr<AudioFileSource> afs
Session::count_sources_by_origin (const string& path)
{
uint32_t cnt = 0;
- Glib::Mutex::Lock lm (source_lock);
+ Glib::Threads::Mutex::Lock lm (source_lock);
for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) {
boost::shared_ptr<FileSource> fs
boost::optional<framecnt_t>
Session::available_capture_duration ()
{
- Glib::Mutex::Lock lm (space_lock);
+ Glib::Threads::Mutex::Lock lm (space_lock);
if (_total_free_4k_blocks_uncertain) {
return boost::optional<framecnt_t> ();
Session::initialize_latencies ()
{
{
- Glib::Mutex::Lock lm (_engine.process_lock());
+ Glib::Threads::Mutex::Lock lm (_engine.process_lock());
update_latency (false);
update_latency (true);
}
#include <fcntl.h>
#include <poll.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/error.h"
#include "pbd/pthread_utils.h"
return;
}
- Glib::RWLock::WriterLock clickm (click_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::WriterLock clickm (click_lock, Glib::Threads::TRY_LOCK);
/* how far have we moved since the last time the clicks got cleared
*/
void
Session::clear_clicks ()
{
- Glib::RWLock::WriterLock lm (click_lock);
+ Glib::Threads::RWLock::WriterLock lm (click_lock);
for (Clicks::iterator i = clicks.begin(); i != clicks.end(); ++i) {
delete *i;
#include "pbd/error.h"
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <midi++/manager.h>
#include <midi++/mmc.h>
bool
SessionPlaylists::add (boost::shared_ptr<Playlist> playlist)
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
bool const existing = find (playlists.begin(), playlists.end(), playlist) != playlists.end();
void
SessionPlaylists::remove (boost::shared_ptr<Playlist> playlist)
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
List::iterator i;
}
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
if (!inuse) {
uint32_t
SessionPlaylists::n_playlists () const
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
return playlists.size();
}
boost::shared_ptr<Playlist>
SessionPlaylists::by_name (string name)
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
if ((*i)->name() == name) {
boost::shared_ptr<Playlist>
SessionPlaylists::by_id (const PBD::ID& id)
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
if ((*i)->id() == id) {
void
SessionPlaylists::unassigned (std::list<boost::shared_ptr<Playlist> > & list)
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
if (!(*i)->get_orig_track_id().to_s().compare ("0")) {
void
SessionPlaylists::get (vector<boost::shared_ptr<Playlist> >& s) const
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
s.push_back (*i);
void
SessionPlaylists::destroy_region (boost::shared_ptr<Region> r)
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
(*i)->destroy_region (r);
void
SessionPlaylists::sync_all_regions_with_regions ()
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
for (List::const_iterator p = playlists.begin(); p != playlists.end(); ++p) {
(*p)->sync_all_regions_with_regions ();
boost::shared_ptr<Crossfade>
SessionPlaylists::find_crossfade (const PBD::ID& id)
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
boost::shared_ptr<Crossfade> c;
uint32_t
SessionPlaylists::region_use_count (boost::shared_ptr<Region> region) const
{
- Glib::Mutex::Lock lm (lock);
+ Glib::Threads::Mutex::Lock lm (lock);
uint32_t cnt = 0;
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
#include "pbd/error.h"
#include "pbd/enumwriter.h"
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/audioengine.h"
#include "ardour/auditioner.h"
#include <glib/gstdio.h>
#include <glibmm.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <boost/algorithm/string.hpp>
// boost_debug_shared_ptr_mark_interesting (r.get(), "Route");
#endif
{
- Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
r->input()->ensure_io (count, false, this);
r->output()->ensure_io (count, false, this);
}
child = node->add_child ("Sources");
if (full_state) {
- Glib::Mutex::Lock sl (source_lock);
+ Glib::Threads::Mutex::Lock sl (source_lock);
for (SourceMap::iterator siter = sources.begin(); siter != sources.end(); ++siter) {
child = node->add_child ("Regions");
if (full_state) {
- Glib::Mutex::Lock rl (region_lock);
+ Glib::Threads::Mutex::Lock rl (region_lock);
const RegionFactory::RegionMap& region_map (RegionFactory::all_regions());
for (RegionFactory::RegionMap::const_iterator i = region_map.begin(); i != region_map.end(); ++i) {
boost::shared_ptr<Region> r = i->second;
{
XMLNode* node = new XMLNode (X_("Sources"));
- Glib::Mutex::Lock lm (source_lock);
+ Glib::Threads::Mutex::Lock lm (source_lock);
for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) {
node->add_child_nocopy (i->second->get_state());
{
#if HAVE_SYS_VFS_H && HAVE_SYS_STATVFS_H
- Glib::Mutex::Lock lm (space_lock);
+ Glib::Threads::Mutex::Lock lm (space_lock);
/* get freespace on every FS that is part of the session path */
as part of the session.
*/
- Glib::Mutex::Lock lm (controllables_lock);
+ Glib::Threads::Mutex::Lock lm (controllables_lock);
controllables.insert (c);
}
return;
}
- Glib::Mutex::Lock lm (controllables_lock);
+ Glib::Threads::Mutex::Lock lm (controllables_lock);
Controllables::iterator x = controllables.find (boost::shared_ptr<Controllable>(c, null_deleter()));
boost::shared_ptr<Controllable>
Session::controllable_by_id (const PBD::ID& id)
{
- Glib::Mutex::Lock lm (controllables_lock);
+ Glib::Threads::Mutex::Lock lm (controllables_lock);
for (Controllables::iterator i = controllables.begin(); i != controllables.end(); ++i) {
if ((*i)->id() == id) {
} else if (p == "edit-mode") {
- Glib::Mutex::Lock lm (playlists->lock);
+ Glib::Threads::Mutex::Lock lm (playlists->lock);
for (SessionPlaylists::List::iterator i = playlists->playlists.begin(); i != playlists->playlists.end(); ++i) {
(*i)->set_edit_mode (Config->get_edit_mode ());
/* this is functionally what clear_clicks() does but with a tentative lock */
- Glib::RWLock::WriterLock clickm (click_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::WriterLock clickm (click_lock, Glib::Threads::TRY_LOCK);
if (clickm.locked()) {
void
SMFSource::mark_midi_streaming_write_completed (Evoral::Sequence<Evoral::MusicalTime>::StuckNoteOption stuck_notes_option, Evoral::MusicalTime when)
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
MidiSource::mark_midi_streaming_write_completed (stuck_notes_option, when);
if (!writable()) {
return;
}
- boost::shared_ptr<Glib::Mutex::Lock> lm;
+ boost::shared_ptr<Glib::Threads::Mutex::Lock> lm;
if (lock)
- lm = boost::shared_ptr<Glib::Mutex::Lock>(new Glib::Mutex::Lock(_lock));
+ lm = boost::shared_ptr<Glib::Threads::Mutex::Lock>(new Glib::Threads::Mutex::Lock(_lock));
if (_model && !force_reload) {
return;
#include <algorithm>
#include <fstream>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <glibmm/miscutils.h>
#include <glibmm/fileutils.h>
#include "pbd/xml++.h"
bool
Source::has_been_analysed() const
{
- Glib::Mutex::Lock lm (_analysis_lock);
+ Glib::Threads::Mutex::Lock lm (_analysis_lock);
return _analysed;
}
Source::set_been_analysed (bool yn)
{
{
- Glib::Mutex::Lock lm (_analysis_lock);
+ Glib::Threads::Mutex::Lock lm (_analysis_lock);
_analysed = yn;
}
Source::dec_use_count ()
{
#ifndef NDEBUG
- gint oldval = g_atomic_int_exchange_and_add (&_use_count, -1);
+ gint oldval = g_atomic_int_add (&_use_count, -1);
if (oldval <= 0) {
cerr << "Bad use dec for " << name() << endl;
abort ();
}
assert (oldval > 0);
#else
- g_atomic_int_exchange_and_add (&_use_count, -1);
+ g_atomic_int_add (&_use_count, -1);
#endif
}
using namespace PBD;
PBD::Signal1<void,boost::shared_ptr<Source> > SourceFactory::SourceCreated;
-Glib::Cond* SourceFactory::PeaksToBuild;
-Glib::StaticMutex SourceFactory::peak_building_lock = GLIBMM_STATIC_MUTEX_INIT;
+Glib::Threads::Cond SourceFactory::PeaksToBuild;
+Glib::Threads::Mutex SourceFactory::peak_building_lock;
std::list<boost::weak_ptr<AudioSource> > SourceFactory::files_with_peaks;
static void
wait:
if (SourceFactory::files_with_peaks.empty()) {
- SourceFactory::PeaksToBuild->wait (SourceFactory::peak_building_lock);
+ SourceFactory::PeaksToBuild.wait (SourceFactory::peak_building_lock);
}
if (SourceFactory::files_with_peaks.empty()) {
void
SourceFactory::init ()
{
- PeaksToBuild = new Glib::Cond();
-
for (int n = 0; n < 2; ++n) {
- Glib::Thread::create (sigc::ptr_fun (::peak_thread_work), false);
+ Glib::Threads::Thread::create (sigc::ptr_fun (::peak_thread_work));
}
}
if (async) {
- Glib::Mutex::Lock lm (peak_building_lock);
+ Glib::Threads::Mutex::Lock lm (peak_building_lock);
files_with_peaks.push_back (boost::weak_ptr<AudioSource> (as));
- PeaksToBuild->broadcast ();
+ PeaksToBuild.broadcast ();
} else {
#include <unistd.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/xml++.h"
#include "evoral/types.hpp"
#include "ardour/debug.h"
bool removed = false;
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
Metrics::iterator i;
for (i = metrics.begin(); i != metrics.end(); ++i) {
bool removed = false;
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
Metrics::iterator i;
for (i = metrics.begin(); i != metrics.end(); ++i) {
add_tempo (tempo, where);
} else {
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
/* cannot move the first tempo section */
*((Tempo*)&first) = tempo;
recompute_map (false);
TempoMap::add_tempo (const Tempo& tempo, BBT_Time where)
{
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
/* new tempos always start on a beat */
where.ticks = 0;
add_meter (meter, where);
} else {
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
/* cannot move the first meter section */
*((Meter*)&first) = meter;
recompute_map (true);
TempoMap::add_meter (const Meter& meter, BBT_Time where)
{
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
/* a new meter always starts a new bar on the first beat. so
round the start time appropriately. remember that
for (Metrics::iterator i = metrics.begin(); i != metrics.end(); ++i) {
if ((t = dynamic_cast<TempoSection*> (*i)) != 0) {
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
*((Tempo*) t) = newtempo;
recompute_map (false);
}
/* reset */
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
/* cannot move the first tempo section */
*((Tempo*)prev) = newtempo;
recompute_map (false);
void
TempoMap::require_map_to (framepos_t pos)
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
if (_map.empty() || _map.back().frame < pos) {
extend_map (pos);
void
TempoMap::require_map_to (const BBT_Time& bbt)
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
/* since we have no idea where BBT is if its off the map, see the last
* point in the map is past BBT, and if not add an arbitrary amount of
TempoMetric
TempoMap::metric_at (framepos_t frame) const
{
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
TempoMetric m (first_meter(), first_tempo());
const Meter* meter;
const Tempo* tempo;
TempoMetric
TempoMap::metric_at (BBT_Time bbt) const
{
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
TempoMetric m (first_meter(), first_tempo());
const Meter* meter;
const Tempo* tempo;
{
require_map_to (frame);
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
if (frame < 0) {
bbt.bars = 1;
void
TempoMap::bbt_time_rt (framepos_t frame, BBT_Time& bbt)
{
- Glib::RWLock::ReaderLock lm (lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
throw std::logic_error ("TempoMap::bbt_time_rt() could not lock tempo map");
require_map_to (bbt);
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
BBTPointList::const_iterator s = bbt_before_or_at (BBT_Time (1, 1, 0));
BBTPointList::const_iterator e = bbt_before_or_at (BBT_Time (bbt.bars, bbt.beats, 0));
BBT_Time when;
bbt_time (pos, when);
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
return bbt_duration_at_unlocked (when, bbt, dir);
}
{
require_map_to (fr);
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
BBTPointList::const_iterator i = bbt_before_or_at (fr);
BBT_Time the_beat;
uint32_t ticks_one_subdivisions_worth;
{
require_map_to (frame);
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
BBTPointList::const_iterator fi;
if (dir > 0) {
framepos_t lower, framepos_t upper)
{
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
if (_map.empty() || (_map.back().frame < upper)) {
recompute_map (false, upper);
}
const TempoSection&
TempoMap::tempo_section_at (framepos_t frame) const
{
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
Metrics::const_iterator i;
TempoSection* prev = 0;
XMLNode *root = new XMLNode ("TempoMap");
{
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
for (i = metrics.begin(); i != metrics.end(); ++i) {
root->add_child_nocopy ((*i)->get_state());
}
TempoMap::set_state (const XMLNode& node, int /*version*/)
{
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
XMLNodeList nlist;
XMLNodeConstIterator niter;
void
TempoMap::dump (std::ostream& o) const
{
- Glib::RWLock::ReaderLock lm (lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (lock, Glib::Threads::TRY_LOCK);
const MeterSection* m;
const TempoSection* t;
int
TempoMap::n_tempos() const
{
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
int cnt = 0;
for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
int
TempoMap::n_meters() const
{
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
int cnt = 0;
for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
TempoMap::insert_time (framepos_t where, framecnt_t amount)
{
{
- Glib::RWLock::WriterLock lm (lock);
+ Glib::Threads::RWLock::WriterLock lm (lock);
for (Metrics::iterator i = metrics.begin(); i != metrics.end(); ++i) {
if ((*i)->frame() >= where && (*i)->movable ()) {
(*i)->set_frame ((*i)->frame() + amount);
framepos_t
TempoMap::framepos_plus_beats (framepos_t pos, Evoral::MusicalTime beats) const
{
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
Metrics::const_iterator next_tempo;
const TempoSection* tempo = 0;
framepos_t
TempoMap::framepos_minus_beats (framepos_t pos, Evoral::MusicalTime beats) const
{
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
Metrics::const_reverse_iterator prev_tempo;
const TempoSection* tempo = 0;
framepos_t
TempoMap::framepos_plus_bbt (framepos_t pos, BBT_Time op) const
{
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
Metrics::const_iterator i;
const MeterSection* meter;
const MeterSection* m;
Evoral::MusicalTime
TempoMap::framewalk_to_beats (framepos_t pos, framecnt_t distance) const
{
- Glib::RWLock::ReaderLock lm (lock);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
Metrics::const_iterator next_tempo;
const TempoSection* tempo = 0;
framepos_t effective_pos = max (pos, (framepos_t) 0);
Track::deactivate_visible_processors ()
{
_deactivated_processors.clear ();
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
if ((*i)->active() && (*i)->display_to_user() && boost::dynamic_pointer_cast<Amp> (*i) == 0) {
int
Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool session_state_changing)
{
- Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
return 0;
}
int
Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*end_frame*/, bool& need_butler)
{
- Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
return 0;
}
to reflect that we just wrote _roll_delay frames of silence.
*/
- Glib::RWLock::ReaderLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
boost::shared_ptr<IOProcessor> iop = boost::dynamic_pointer_cast<IOProcessor> (*i);
if (iop) {
node->add_property ("name", name ());
{
- Glib::Mutex::Lock lm (_channel_mutex);
+ Glib::Threads::Mutex::Lock lm (_channel_mutex);
for (std::vector<Channel>::iterator i = _channel.begin(); i != _channel.end(); ++i) {
XMLNode* c = new XMLNode ("Channel");
Worker::Worker(Workee* workee, uint32_t ring_size)
: _workee(workee)
- , _thread(Glib::Thread::create(sigc::mem_fun(*this, &Worker::run), true))
+ , _thread (Glib::Threads::Thread::create(sigc::mem_fun(*this, &Worker::run)))
, _requests(new RingBuffer<uint8_t>(ring_size))
, _responses(new RingBuffer<uint8_t>(ring_size))
, _response((uint8_t*)malloc(ring_size))
#define AUDIOGRAPHER_THREADER_H
#include <glibmm/threadpool.h>
+#include <glibmm/timeval.h>
#include <sigc++/slot.h>
#include <boost/format.hpp>
void wait()
{
while (g_atomic_int_get (&readers) != 0) {
- Glib::TimeVal wait_time;
- wait_time.assign_current_time();
- wait_time.add_milliseconds(wait_timeout);
-
- wait_cond.timed_wait(wait_mutex, wait_time);
+ gint64 end_time = g_get_monotonic_time () + (wait_timeout * G_TIME_SPAN_MILLISECOND);
+ wait_cond.wait_until(wait_mutex, end_time);
}
wait_mutex.unlock();
OutputVec outputs;
Glib::ThreadPool & thread_pool;
- Glib::Mutex wait_mutex;
- Glib::Cond wait_cond;
+ Glib::Threads::Mutex wait_mutex;
+ Glib::Threads::Cond wait_cond;
gint readers;
long wait_timeout;
- Glib::Mutex exception_mutex;
+ Glib::Threads::Mutex exception_mutex;
boost::shared_ptr<ThreaderException> exception;
};
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
-#include <glibmm/thread.h>
-
int main()
{
Glib::thread_init();
#include <list>
#include <boost/pool/pool.hpp>
#include <boost/pool/pool_alloc.hpp>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/signals.h"
#include "evoral/types.hpp"
#include "evoral/Range.hpp"
EventList::size_type size() const { return _events.size(); }
double length() const {
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
return _events.empty() ? 0.0 : _events.back()->when;
}
bool empty() const { return _events.empty(); }
std::pair<ControlList::iterator,ControlList::iterator> control_points_adjacent (double when);
template<class T> void apply_to_points (T& obj, void (T::*method)(const ControlList&)) {
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
(obj.*method)(*this);
}
double eval (double where) {
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
return unlocked_eval (where);
}
double rt_safe_eval (double where, bool& ok) {
- Glib::Mutex::Lock lm (_lock, Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock lm (_lock, Glib::Threads::TRY_LOCK);
if ((ok = lm.locked())) {
return unlocked_eval (where);
double default_value() const { return _parameter.normal(); }
// FIXME: const violations for Curve
- Glib::Mutex& lock() const { return _lock; }
+ Glib::Threads::Mutex& lock() const { return _lock; }
LookupCache& lookup_cache() const { return _lookup_cache; }
SearchCache& search_cache() const { return _search_cache; }
Parameter _parameter;
InterpolationStyle _interpolation;
EventList _events;
- mutable Glib::Mutex _lock;
+ mutable Glib::Threads::Mutex _lock;
int8_t _frozen;
bool _changed_when_thawed;
double _min_yval;
#include <map>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/signals.h"
#include "evoral/types.hpp"
#include "evoral/Parameter.hpp"
void what_has_data(std::set<Parameter>&) const;
- Glib::Mutex& control_lock() const { return _control_lock; }
+ Glib::Threads::Mutex& control_lock() const { return _control_lock; }
protected:
virtual void control_list_marked_dirty () {}
virtual void control_list_interpolation_changed (Parameter, ControlList::InterpolationStyle) {}
- mutable Glib::Mutex _control_lock;
+ mutable Glib::Threads::Mutex _control_lock;
Controls _controls;
PBD::ScopedConnectionList _list_connections;
#include <list>
#include <utility>
#include <boost/shared_ptr.hpp>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "evoral/types.hpp"
#include "evoral/Note.hpp"
#include "evoral/Parameter.hpp"
protected:
struct WriteLockImpl {
- WriteLockImpl(Glib::RWLock& s, Glib::Mutex& c)
- : sequence_lock(new Glib::RWLock::WriterLock(s))
- , control_lock(new Glib::Mutex::Lock(c))
+ WriteLockImpl(Glib::Threads::RWLock& s, Glib::Threads::Mutex& c)
+ : sequence_lock(new Glib::Threads::RWLock::WriterLock(s))
+ , control_lock(new Glib::Threads::Mutex::Lock(c))
{ }
~WriteLockImpl() {
delete sequence_lock;
delete control_lock;
}
- Glib::RWLock::WriterLock* sequence_lock;
- Glib::Mutex::Lock* control_lock;
+ Glib::Threads::RWLock::WriterLock* sequence_lock;
+ Glib::Threads::Mutex::Lock* control_lock;
};
public:
typedef typename boost::shared_ptr<Evoral::Note<Time> > NotePtr;
typedef typename boost::shared_ptr<const Evoral::Note<Time> > constNotePtr;
- typedef boost::shared_ptr<Glib::RWLock::ReaderLock> ReadLock;
+ typedef boost::shared_ptr<Glib::Threads::RWLock::ReaderLock> ReadLock;
typedef boost::shared_ptr<WriteLockImpl> WriteLock;
- virtual ReadLock read_lock() const { return ReadLock(new Glib::RWLock::ReaderLock(_lock)); }
+ virtual ReadLock read_lock() const { return ReadLock(new Glib::Threads::RWLock::ReaderLock(_lock)); }
virtual WriteLock write_lock() { return WriteLock(new WriteLockImpl(_lock, _control_lock)); }
void clear();
bool _edited;
bool _overlapping_pitches_accepted;
OverlapPitchResolution _overlap_pitch_resolution;
- mutable Glib::RWLock _lock;
+ mutable Glib::Threads::RWLock _lock;
bool _writing;
virtual int resolve_overlaps_unlocked (const NotePtr, void* /* arg */ = 0) {
ControlList::copy_events (const ControlList& other)
{
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
_events.clear ();
for (const_iterator i = other.begin(); i != other.end(); ++i) {
_events.push_back (new ControlEvent ((*i)->when, (*i)->value));
ControlList::clear ()
{
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
_events.clear ();
unlocked_invalidate_insert_iterator ();
mark_dirty ();
void
ControlList::x_scale (double factor)
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
_x_scale (factor);
}
bool
ControlList::extend_to (double when)
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
if (_events.empty() || _events.back()->when == when) {
return false;
}
ControlList::merge_nascent (double when)
{
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
if (nascent.empty()) {
return;
bool changed = false;
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
ControlEvent* prevprev = 0;
ControlEvent* cur = 0;
void
ControlList::fast_simple_add (double when, double value)
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
/* to be used only for loading pre-sorted data from saved state */
_events.insert (_events.end(), new ControlEvent (when, value));
assert(_events.back());
void
ControlList::invalidate_insert_iterator ()
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
unlocked_invalidate_insert_iterator ();
}
void
ControlList::start_write_pass (double when)
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
new_write_pass = true;
did_write_during_pass = false;
this, value, when, _in_write_pass, (most_recent_insert_iterator == _events.end())));
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
ControlEvent cp (when, 0.0f);
iterator insertion_point;
ControlList::erase (iterator i)
{
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
if (most_recent_insert_iterator == i) {
unlocked_invalidate_insert_iterator ();
}
ControlList::erase (iterator start, iterator end)
{
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
_events.erase (start, end);
unlocked_invalidate_insert_iterator ();
mark_dirty ();
ControlList::erase (double when, double value)
{
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
iterator i = begin ();
while (i != end() && ((*i)->when != when || (*i)->value != value)) {
bool erased = false;
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
erased = erase_range_internal (start, endt, _events);
if (erased) {
ControlList::slide (iterator before, double distance)
{
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
if (before == _events.end()) {
return;
ControlList::shift (double pos, double frames)
{
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
for (iterator i = _events.begin(); i != _events.end(); ++i) {
if ((*i)->when >= pos) {
*/
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
(*iter)->when = when;
(*iter)->value = val;
std::pair<ControlList::iterator,ControlList::iterator>
ControlList::control_points_adjacent (double xval)
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
iterator i;
ControlEvent cp (xval, 0.0f);
std::pair<iterator,iterator> ret;
}
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
if (_sort_pending) {
_events.sort (event_time_less_than);
ControlList::truncate_end (double last_coordinate)
{
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
ControlEvent cp (last_coordinate, 0);
ControlList::reverse_iterator i;
double last_val;
ControlList::truncate_start (double overall_length)
{
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
iterator i;
double first_legal_value;
double first_legal_coordinate;
ControlList::rt_safe_earliest_event (double start, double& x, double& y, bool inclusive) const
{
// FIXME: It would be nice if this was unnecessary..
- Glib::Mutex::Lock lm(_lock, Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock lm(_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
return false;
}
ControlEvent cp (start, 0.0);
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
/* first, determine s & e, two iterators that define the range of points
affected by this operation
}
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
iterator where;
iterator prev;
double end = 0;
typedef list< RangeMove<double> > RangeMoveList;
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
/* a copy of the events list before we started moving stuff around */
EventList old_events = _events;
void
ControlSet::what_has_data (set<Parameter>& s) const
{
- Glib::Mutex::Lock lm (_control_lock);
+ Glib::Threads::Mutex::Lock lm (_control_lock);
for (Controls::const_iterator li = _controls.begin(); li != _controls.end(); ++li) {
if (li->second->list() && !li->second->list()->empty()) {
void
ControlSet::clear_controls ()
{
- Glib::Mutex::Lock lm (_control_lock);
+ Glib::Threads::Mutex::Lock lm (_control_lock);
_control_connections.drop_connections ();
_list_connections.drop_connections ();
#include <cfloat>
#include <cmath>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "evoral/Curve.hpp"
#include "evoral/ControlList.hpp"
bool
Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen)
{
- Glib::Mutex::Lock lm(_list.lock(), Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock lm(_list.lock(), Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
return false;
void
Curve::get_vector (double x0, double x1, float *vec, int32_t veclen)
{
- Glib::Mutex::Lock lm(_list.lock());
+ Glib::Threads::Mutex::Lock lm(_list.lock());
_get_vector (x0, x1, vec, veclen);
}
which is assumed to have called this.
*/
- run_loop_thread = Thread::self();
+ run_loop_thread = Threads::Thread::self();
/* store "this" as the UI-for-thread of this thread, same argument
as for previous line.
bool
UI::caller_is_ui_thread ()
{
- return Thread::self() == run_loop_thread;
+ return Threads::Thread::self() == run_loop_thread;
}
int
bool caller_is_ui_thread ();
- static Glib::Thread* thread_id() { return gui_thread; }
-
/* Gtk-UI specific interfaces */
bool running ();
static bool just_hide_it (GdkEventAny *, Gtk::Window *);
- static Glib::Thread* the_gui_thread() { return gui_thread; }
-
protected:
virtual void handle_fatal (const char *);
virtual void display_message (const char *prefix, gint prefix_len,
private:
static UI *theGtkUI;
- static Glib::Thread* gui_thread;
+
bool _active;
Gtk::Main *theMain;
#ifndef GTK_NEW_TOOLTIP_API
IPMIDIPort::write (const byte* msg, size_t msglen, timestamp_t /* ignored */) {
if (sockout) {
- Glib::Mutex::Lock lm (write_lock);
+ Glib::Threads::Mutex::Lock lm (write_lock);
if (::sendto (sockout, (const char *) msg, msglen, 0, (struct sockaddr *) &addrout, sizeof(struct sockaddr_in)) < 0) {
::perror("sendto");
return -1;
if (!is_process_thread()) {
- Glib::Mutex::Lock lm (output_fifo_lock);
+ Glib::Threads::Mutex::Lock lm (output_fifo_lock);
RingBuffer< Evoral::Event<double> >::rw_vector vec = { { 0, 0 }, { 0, 0} };
output_fifo.get_write_vector (&vec);
#include <net/if.h>
#endif
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <jack/types.h>
int sockin;
int sockout;
struct sockaddr_in addrout;
- Glib::Mutex write_lock;
+ Glib::Threads::Mutex write_lock;
bool open_sockets (int base_port, const std::string& ifname);
void close_sockets ();
timestamp_t _last_write_timestamp;
RingBuffer< Evoral::Event<double> > output_fifo;
Evoral::EventRingBuffer<timestamp_t> input_fifo;
- Glib::Mutex output_fifo_lock;
+ Glib::Threads::Mutex output_fifo_lock;
CrossThreadChannel xthread;
int create_port ();
bool
BaseUI::signal_running ()
{
- Glib::Mutex::Lock lm (_run_lock);
+ Glib::Threads::Mutex::Lock lm (_run_lock);
_running.signal ();
return false; // don't call it again
/* glibmm hack - drop the refptr to the IOSource now before it can hurt */
request_channel.drop_ios ();
- Glib::Mutex::Lock lm (_run_lock);
- run_loop_thread = Thread::create (mem_fun (*this, &BaseUI::main_thread), true);
+ Glib::Threads::Mutex::Lock lm (_run_lock);
+ run_loop_thread = Glib::Threads::Thread::create (mem_fun (*this, &BaseUI::main_thread));
_running.wait (_run_lock);
}
#include <map>
#include <set>
#include <vector>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <boost/shared_ptr.hpp>
#include "pbd/stacktrace.h"
return *_interesting_pointers;
}
-static Glib::Mutex* _the_lock;
-static Glib::Mutex& the_lock() {
+static Glib::Threads::Mutex* _the_lock;
+static Glib::Threads::Mutex& the_lock() {
if (_the_lock == 0) {
- _the_lock = new Glib::Mutex;
+ _the_lock = new Glib::Threads::Mutex;
}
return *_the_lock;
}
void
boost_debug_shared_ptr_mark_interesting (void* ptr, const char* type)
{
- Glib::Mutex::Lock guard (the_lock());
+ Glib::Threads::Mutex::Lock guard (the_lock());
pair<void*,const char*> newpair (ptr, type);
interesting_pointers().insert (newpair);
if (debug_out) {
return;
}
- Glib::Mutex::Lock guard (the_lock());
+ Glib::Threads::Mutex::Lock guard (the_lock());
if (is_interesting_object (old_obj) || is_interesting_object (obj)) {
if (debug_out) {
return;
}
- Glib::Mutex::Lock guard (the_lock());
+ Glib::Threads::Mutex::Lock guard (the_lock());
if (is_interesting_object (old_obj) || is_interesting_object (obj)) {
if (debug_out) {
void
boost_debug_shared_ptr_destructor (void const *sp, void const *obj, int use_count)
{
- Glib::Mutex::Lock guard (the_lock());
+ Glib::Threads::Mutex::Lock guard (the_lock());
PointerMap::iterator x = sptrs().find (sp);
if (x != sptrs().end()) {
boost_debug_shared_ptr_constructor (void const *sp, void const *obj, int use_count)
{
if (is_interesting_object (obj)) {
- Glib::Mutex::Lock guard (the_lock());
+ Glib::Threads::Mutex::Lock guard (the_lock());
pair<void const*, SPDebug*> newpair;
newpair.first = sp;
void
boost_debug_count_ptrs ()
{
- Glib::Mutex::Lock guard (the_lock());
+ Glib::Threads::Mutex::Lock guard (the_lock());
// cerr << "Tracking " << interesting_pointers().size() << " interesting objects with " << sptrs().size () << " shared ptrs\n";
}
void
boost_debug_list_ptrs ()
{
- Glib::Mutex::Lock guard (the_lock());
+ Glib::Threads::Mutex::Lock guard (the_lock());
if (sptrs().empty()) {
cerr << "There are no dangling shared ptrs\n";
PBD::Signal3<void,Controllable*,int,int> Controllable::CreateBinding;
PBD::Signal1<void,Controllable*> Controllable::DeleteBinding;
-Glib::StaticRWLock Controllable::registry_lock = GLIBMM_STATIC_RW_LOCK_INIT;
+Glib::Threads::RWLock Controllable::registry_lock;
Controllable::Controllables Controllable::registry;
PBD::ScopedConnectionList* registry_connections = 0;
const std::string Controllable::xml_node_name = X_("Controllable");
{
using namespace boost;
- Glib::RWLock::WriterLock lm (registry_lock);
+ Glib::Threads::RWLock::WriterLock lm (registry_lock);
registry.insert (&ctl);
if (!registry_connections) {
void
Controllable::remove (Controllable* ctl)
{
- Glib::RWLock::WriterLock lm (registry_lock);
+ Glib::Threads::RWLock::WriterLock lm (registry_lock);
for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) {
if ((*i) == ctl) {
Controllable*
Controllable::by_id (const ID& id)
{
- Glib::RWLock::ReaderLock lm (registry_lock);
+ Glib::Threads::RWLock::ReaderLock lm (registry_lock);
for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) {
if ((*i)->id() == id) {
Controllable*
Controllable::by_name (const string& str)
{
- Glib::RWLock::ReaderLock lm (registry_lock);
+ Glib::Threads::RWLock::ReaderLock lm (registry_lock);
for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) {
if ((*i)->_name == str) {
using namespace PBD;
using namespace std;
-Glib::StaticPrivate<EventLoop> EventLoop::thread_event_loop;
-
static void do_not_delete_the_loop_pointer (void*) { }
+Glib::Threads::Private<EventLoop> EventLoop::thread_event_loop (do_not_delete_the_loop_pointer);
+
EventLoop*
EventLoop::get_event_loop_for_thread() {
return thread_event_loop.get ();
void
EventLoop::set_event_loop_for_thread (EventLoop* loop)
{
- thread_event_loop.set (loop, do_not_delete_the_loop_pointer);
+ thread_event_loop.set (loop);
}
void*
*/
if (ir->event_loop) {
- Glib::Mutex::Lock lm (ir->event_loop->slot_invalidation_mutex());
+ Glib::Threads::Mutex::Lock lm (ir->event_loop->slot_invalidation_mutex());
for (list<BaseRequestObject*>::iterator i = ir->requests.begin(); i != ir->requests.end(); ++i) {
(*i)->valid = false;
(*i)->invalidation = 0;
void
FileManager::add (FileDescriptor* d)
{
- Glib::Mutex::Lock lm (_mutex);
+ Glib::Threads::Mutex::Lock lm (_mutex);
_files.push_back (d);
}
bool
FileManager::allocate (FileDescriptor* d)
{
- Glib::Mutex::Lock lm (_mutex);
+ Glib::Threads::Mutex::Lock lm (_mutex);
if (!d->is_open()) {
void
FileManager::release (FileDescriptor* d)
{
- Glib::Mutex::Lock lm (_mutex);
+ Glib::Threads::Mutex::Lock lm (_mutex);
d->_refcount--;
assert (d->_refcount >= 0);
void
FileManager::remove (FileDescriptor* d)
{
- Glib::Mutex::Lock lm (_mutex);
+ Glib::Threads::Mutex::Lock lm (_mutex);
if (d->is_open ()) {
close (d);
using namespace std;
using namespace PBD;
-Glib::Mutex* ID::counter_lock = 0;
+Glib::Threads::Mutex* ID::counter_lock = 0;
uint64_t ID::_counter = 0;
void
ID::init ()
{
if (!counter_lock)
- counter_lock = new Glib::Mutex;
+ counter_lock = new Glib::Threads::Mutex;
}
ID::ID ()
void
ID::reset ()
{
- Glib::Mutex::Lock lm (*counter_lock);
+ Glib::Threads::Mutex::Lock lm (*counter_lock);
_id = _counter++;
}
using namespace std;
-template<typename R>
-Glib::StaticPrivate<typename AbstractUI<R>::RequestBuffer> AbstractUI<R>::per_thread_request_buffer;
-
template<typename RequestBuffer> void
cleanup_request_buffer (void* ptr)
{
{
- Glib::Mutex::Lock lm (rb->ui.request_buffer_map_lock);
+ Glib::Threads::Mutex::Lock lm (rb->ui.request_buffer_map_lock);
rb->dead = true;
}
}
+template<typename R>
+Glib::Threads::Private<typename AbstractUI<R>::RequestBuffer> AbstractUI<R>::per_thread_request_buffer (cleanup_request_buffer<AbstractUI<R>::RequestBuffer>);
+
template <typename RequestObject>
AbstractUI<RequestObject>::AbstractUI (const string& name)
: BaseUI (name)
only at thread initialization time, not repeatedly,
and so this is of little consequence.
*/
- Glib::Mutex::Lock lm (request_buffer_map_lock);
+ Glib::Threads::Mutex::Lock lm (request_buffer_map_lock);
request_buffers[thread_id] = b;
}
dead. it will then be deleted during a call to handle_ui_requests()
*/
- per_thread_request_buffer.set (b, cleanup_request_buffer<RequestBuffer>);
+ per_thread_request_buffer.set (b);
}
template <typename RequestObject> RequestObject*
/* and now, the generic request buffer. same rules as above apply */
- Glib::Mutex::Lock lm (request_list_lock);
+ Glib::Threads::Mutex::Lock lm (request_list_lock);
while (!request_list.empty()) {
RequestObject* req = request_list.front ();
single-reader/single-writer semantics
*/
DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 send heap request type %3\n", name(), pthread_self(), req->type));
- Glib::Mutex::Lock lm (request_list_lock);
+ Glib::Threads::Mutex::Lock lm (request_list_lock);
request_list.push_back (req);
}
#include <string>
#include <pthread.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/receiver.h"
#include "pbd/ringbufferNPT.h"
void register_thread (std::string, pthread_t, std::string, uint32_t num_requests);
void call_slot (EventLoop::InvalidationRecord*, const boost::function<void()>&);
- Glib::Mutex& slot_invalidation_mutex() { return request_buffer_map_lock; }
+ Glib::Threads::Mutex& slot_invalidation_mutex() { return request_buffer_map_lock; }
- Glib::Mutex request_buffer_map_lock;
+ Glib::Threads::Mutex request_buffer_map_lock;
protected:
struct RequestBuffer : public PBD::RingBufferNPT<RequestObject> {
typedef std::map<pthread_t,RequestBuffer*> RequestBufferMap;
RequestBufferMap request_buffers;
- static Glib::StaticPrivate<RequestBuffer> per_thread_request_buffer;
+ static Glib::Threads::Private<RequestBuffer> per_thread_request_buffer;
- Glib::Mutex request_list_lock;
+ Glib::Threads::Mutex request_list_lock;
std::list<RequestObject*> request_list;
RequestObject* get_request (RequestType);
#include <sigc++/slot.h>
#include <sigc++/trackable.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <glibmm/main.h>
#include "pbd/crossthread.h"
BaseUI* base_instance() { return base_ui_instance; }
Glib::RefPtr<Glib::MainLoop> main_loop() const { return _main_loop; }
- Glib::Thread* event_loop_thread() const { return run_loop_thread; }
- bool caller_is_self () const { return Glib::Thread::self() == run_loop_thread; }
+ Glib::Threads::Thread* event_loop_thread() const { return run_loop_thread; }
+ bool caller_is_self () const { return Glib::Threads::Thread::self() == run_loop_thread; }
std::string name() const { return _name; }
bool _ok;
Glib::RefPtr<Glib::MainLoop> _main_loop;
- Glib::Thread* run_loop_thread;
- Glib::Mutex _run_lock;
- Glib::Cond _running;
+ Glib::Threads::Thread* run_loop_thread;
+ Glib::Threads::Mutex _run_lock;
+ Glib::Threads::Cond _running;
/* this signals _running from within the event loop,
from an idle callback
#include <map>
#include "pbd/signals.h"
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/statefuldestructible.h"
static void remove (Controllable*);
typedef std::set<PBD::Controllable*> Controllables;
- static Glib::StaticRWLock registry_lock;
+ static Glib::Threads::RWLock registry_lock;
static Controllables registry;
};
#include <boost/function.hpp>
#include <boost/bind.hpp> /* we don't need this here, but anything calling call_slot() probably will, so this is convenient */
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
namespace PBD
{
};
virtual void call_slot (InvalidationRecord*, const boost::function<void()>&) = 0;
- virtual Glib::Mutex& slot_invalidation_mutex() = 0;
+ virtual Glib::Threads::Mutex& slot_invalidation_mutex() = 0;
static EventLoop* get_event_loop_for_thread();
static void set_event_loop_for_thread (EventLoop* ui);
private:
- static Glib::StaticPrivate<EventLoop> thread_event_loop;
+ static Glib::Threads::Private<EventLoop> thread_event_loop;
};
#include <string>
#include <map>
#include <list>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/signals.h"
namespace PBD {
void close (FileDescriptor *);
std::list<FileDescriptor*> _files; ///< files we know about
- Glib::Mutex _mutex; ///< mutex for _files, _open and FileDescriptor contents
+ Glib::Threads::Mutex _mutex; ///< mutex for _files, _open and FileDescriptor contents
int _open; ///< number of open files
int _max_open; ///< maximum number of open files
};
#include <stdint.h>
#include <string>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
namespace PBD {
uint64_t _id;
int string_assign (std::string);
- static Glib::Mutex* counter_lock;
+ static Glib::Threads::Mutex* counter_lock;
static uint64_t _counter;
};
#include <vector>
#include <string>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/ringbuffer.h"
virtual void release (void *);
private:
- Glib::Mutex* m_lock;
+ Glib::Threads::Mutex m_lock;
};
virtual void release (void *);
private:
- Glib::Mutex* m_lock;
+ Glib::Threads::Mutex m_lock;
};
class PerThreadPool;
public:
PerThreadPool ();
- GPrivate* key() const { return _key; }
+ const Glib::Threads::Private<CrossThreadPool>& key() const { return _key; }
void create_per_thread_pool (std::string name, unsigned long item_size, unsigned long nitems);
CrossThreadPool* per_thread_pool ();
void add_to_trash (CrossThreadPool *);
private:
- GPrivate* _key;
+ Glib::Threads::Private<CrossThreadPool> _key;
std::string _name;
unsigned long _item_size;
unsigned long _nitems;
/** mutex to protect either changes to the _trash variable, or writes to the RingBuffer */
- Glib::Mutex _trash_mutex;
+ Glib::Threads::Mutex _trash_mutex;
RingBuffer<CrossThreadPool*>* _trash;
};
#define __pbd_rcu_h__
#include "boost/shared_ptr.hpp"
-#include "glibmm/thread.h"
+#include "glibmm/threads.h"
#include <list>
}
void flush () {
- Glib::Mutex::Lock lm (m_lock);
+ Glib::Threads::Mutex::Lock lm (m_lock);
m_dead_wood.clear ();
}
private:
- Glib::Mutex m_lock;
+ Glib::Threads::Mutex m_lock;
boost::shared_ptr<T>* current_write_old;
std::list<boost::shared_ptr<T> > m_dead_wood;
};
#include <string>
#include <map>
#include <sndfile.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/signals.h"
#include "pbd/file_manager.h"
#include <iostream>
#include <ostream>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <list>
#ifdef HAVE_EXECINFO
#else
allocation_backtrace_size = 0;
#endif
- Glib::Mutex::Lock lm (all_mutex);
+ Glib::Threads::Mutex::Lock lm (all_mutex);
all.push_back (this);
}
#else
allocation_backtrace_size = 0;
#endif
- Glib::Mutex::Lock lm (all_mutex);
+ Glib::Threads::Mutex::Lock lm (all_mutex);
all.push_back (this);
}
if (allocation_backtrace_size) {
delete [] allocation_backtrace;
}
- Glib::Mutex::Lock lm (all_mutex);
+ Glib::Threads::Mutex::Lock lm (all_mutex);
all.remove (this);
}
void** allocation_backtrace;
int allocation_backtrace_size;
static std::list<thing_with_backtrace<T>* > all;
- static Glib::StaticMutex all_mutex;
+ static Glib::Threads::Mutex all_mutex;
};
template<typename T> std::list<PBD::thing_with_backtrace<T> *> PBD::thing_with_backtrace<T>::all;
-template<typename T> Glib::StaticMutex PBD::thing_with_backtrace<T>::all_mutex = GLIBMM_STATIC_MUTEX_INIT;
+template<typename T> Glib::Threads::Mutex PBD::thing_with_backtrace<T>::all_mutex;
} // namespace PBD
XMLNode *_extra_xml;
XMLNode *_instant_xml;
PBD::PropertyChange _pending_changed;
- Glib::Mutex _lock;
+ Glib::Threads::Mutex _lock;
std::string _xml_node_name; ///< name of node to use for this object in XML
OwnedPropertyList* _properties;
MultiAllocSingleReleasePool::MultiAllocSingleReleasePool (string n, unsigned long isize, unsigned long nitems)
: Pool (n, isize, nitems)
- , m_lock(0)
{
}
MultiAllocSingleReleasePool::~MultiAllocSingleReleasePool ()
{
- delete m_lock;
}
SingleAllocMultiReleasePool::SingleAllocMultiReleasePool (string n, unsigned long isize, unsigned long nitems)
: Pool (n, isize, nitems)
- , m_lock(0)
{
}
SingleAllocMultiReleasePool::~SingleAllocMultiReleasePool ()
{
- delete m_lock;
}
void*
MultiAllocSingleReleasePool::alloc ()
{
void *ptr;
- if(!m_lock) {
- m_lock = new Glib::Mutex();
- // umm, I'm not sure that this doesn't also allocate memory.
- if(!m_lock) error << "cannot create Glib::Mutex in pool.cc" << endmsg;
- }
-
- Glib::Mutex::Lock guard(*m_lock);
+ Glib::Threads::Mutex::Lock guard (m_lock);
ptr = Pool::alloc ();
return ptr;
}
void
SingleAllocMultiReleasePool::release (void* ptr)
{
- if(!m_lock) {
- m_lock = new Glib::Mutex();
- // umm, I'm not sure that this doesn't also allocate memory.
- if(!m_lock) error << "cannot create Glib::Mutex in pool.cc" << endmsg;
- }
- Glib::Mutex::Lock guard(*m_lock);
+ Glib::Threads::Mutex::Lock guard (m_lock);
Pool::release (ptr);
}
}
PerThreadPool::PerThreadPool ()
- : _trash (0)
+ : _key (free_per_thread_pool)
+ , _trash (0)
{
- {
- /* for some reason this appears necessary to get glib's thread private stuff to work */
- g_private_new (NULL);
- }
-
- _key = g_private_new (free_per_thread_pool);
}
/** Create a new CrossThreadPool and set the current thread's private _key to point to it.
void
PerThreadPool::create_per_thread_pool (string n, unsigned long isize, unsigned long nitems)
{
- CrossThreadPool* p = new CrossThreadPool (n, isize, nitems, this);
- g_private_set (_key, p);
+ _key.set (new CrossThreadPool (n, isize, nitems, this));
}
/** @return CrossThreadPool for the current thread, which must previously have been created by
CrossThreadPool*
PerThreadPool::per_thread_pool ()
{
- CrossThreadPool* p = static_cast<CrossThreadPool*> (g_private_get (_key));
+ CrossThreadPool* p = _key.get();
if (!p) {
fatal << "programming error: no per-thread pool \"" << _name << "\" for thread " << pthread_self() << endmsg;
/*NOTREACHED*/
void
PerThreadPool::set_trash (RingBuffer<CrossThreadPool*>* t)
{
- Glib::Mutex::Lock lm (_trash_mutex);
+ Glib::Threads::Mutex::Lock lm (_trash_mutex);
_trash = t;
}
void
PerThreadPool::add_to_trash (CrossThreadPool* p)
{
- Glib::Mutex::Lock lm (_trash_mutex);
+ Glib::Threads::Mutex::Lock lm (_trash_mutex);
if (!_trash) {
warning << "Pool " << p->name() << " has no trash collector; a memory leak has therefore occurred" << endmsg;
typedef std::set<pthread_t> ThreadMap;
static ThreadMap all_threads;
static pthread_mutex_t thread_map_lock = PTHREAD_MUTEX_INITIALIZER;
-static Glib::StaticPrivate<char> thread_name;
+static Glib::Threads::Private<char> thread_name (free);
namespace PBD {
PBD::Signal4<void,std::string, pthread_t,std::string,uint32_t> ThreadCreatedWithRequestSize;
{
/* copy string and delete it when exiting */
- thread_name.set (strdup (str), free);
+ thread_name.set (strdup (str));
}
const char *
}
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
if (property_changes_suspended ()) {
_pending_changed.add (what_changed);
return;
PropertyChange what_changed;
{
- Glib::Mutex::Lock lm (_lock);
+ Glib::Threads::Mutex::Lock lm (_lock);
if (property_changes_suspended() && g_atomic_int_dec_and_test (&_stateful_frozen) == FALSE) {
return;
#include <pthread.h>
#include <usb.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/types.h"
ARDOUR::gain_t gain_fraction;
- Glib::Mutex update_lock;
+ Glib::Threads::Mutex update_lock;
bool screen_invalid[2][20];
char screen_current[2][20];
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
-#include <glibmm/thread.h>
#include "pbd/controllable_descriptor.h"
#include "pbd/error.h"
void
GenericMidiControlProtocol::drop_all ()
{
- Glib::Mutex::Lock lm (pending_lock);
- Glib::Mutex::Lock lm2 (controllables_lock);
+ Glib::Threads::Mutex::Lock lm (pending_lock);
+ Glib::Threads::Mutex::Lock lm2 (controllables_lock);
for (MIDIControllables::iterator i = controllables.begin(); i != controllables.end(); ++i) {
delete *i;
void
GenericMidiControlProtocol::drop_bindings ()
{
- Glib::Mutex::Lock lm2 (controllables_lock);
+ Glib::Threads::Mutex::Lock lm2 (controllables_lock);
for (MIDIControllables::iterator i = controllables.begin(); i != controllables.end(); ) {
if (!(*i)->learned()) {
first on to ALSA.
*/
- Glib::Mutex::Lock lm (controllables_lock, Glib::TRY_LOCK);
+ Glib::Threads::Mutex::Lock lm (controllables_lock, Glib::Threads::TRY_LOCK);
if (!lm.locked ()) {
return;
}
return false;
}
- Glib::Mutex::Lock lm2 (controllables_lock);
+ Glib::Threads::Mutex::Lock lm2 (controllables_lock);
MIDIControllables::iterator tmp;
for (MIDIControllables::iterator i = controllables.begin(); i != controllables.end(); ) {
}
{
- Glib::Mutex::Lock lm (pending_lock);
+ Glib::Threads::Mutex::Lock lm (pending_lock);
MIDIPendingControllables::iterator ptmp;
for (MIDIPendingControllables::iterator i = pending_controllables.begin(); i != pending_controllables.end(); ) {
}
{
- Glib::Mutex::Lock lm (pending_lock);
+ Glib::Threads::Mutex::Lock lm (pending_lock);
MIDIPendingControllable* element = new MIDIPendingControllable;
element->first = mc;
void
GenericMidiControlProtocol::learning_stopped (MIDIControllable* mc)
{
- Glib::Mutex::Lock lm (pending_lock);
- Glib::Mutex::Lock lm2 (controllables_lock);
+ Glib::Threads::Mutex::Lock lm (pending_lock);
+ Glib::Threads::Mutex::Lock lm2 (controllables_lock);
MIDIPendingControllables::iterator tmp;
void
GenericMidiControlProtocol::stop_learning (Controllable* c)
{
- Glib::Mutex::Lock lm (pending_lock);
- Glib::Mutex::Lock lm2 (controllables_lock);
+ Glib::Threads::Mutex::Lock lm (pending_lock);
+ Glib::Threads::Mutex::Lock lm2 (controllables_lock);
MIDIControllable* dptr = 0;
/* learning timed out, and we've been told to consider this attempt to learn to be cancelled. find the
GenericMidiControlProtocol::delete_binding (PBD::Controllable* control)
{
if (control != 0) {
- Glib::Mutex::Lock lm2 (controllables_lock);
+ Glib::Threads::Mutex::Lock lm2 (controllables_lock);
for (MIDIControllables::iterator iter = controllables.begin(); iter != controllables.end();) {
MIDIControllable* existingBinding = (*iter);
GenericMidiControlProtocol::create_binding (PBD::Controllable* control, int pos, int control_number)
{
if (control != NULL) {
- Glib::Mutex::Lock lm2 (controllables_lock);
+ Glib::Threads::Mutex::Lock lm2 (controllables_lock);
MIDI::channel_t channel = (pos & 0xf);
MIDI::byte value = control_number;
node->add_child_nocopy (*children);
- Glib::Mutex::Lock lm2 (controllables_lock);
+ Glib::Threads::Mutex::Lock lm2 (controllables_lock);
for (MIDIControllables::iterator i = controllables.begin(); i != controllables.end(); ++i) {
/* we don't care about bindings that come from a bindings map, because
boost::shared_ptr<Controllable> c;
{
- Glib::Mutex::Lock lm (pending_lock);
+ Glib::Threads::Mutex::Lock lm (pending_lock);
for (MIDIPendingControllables::iterator i = pending_controllables.begin(); i != pending_controllables.end(); ++i) {
delete *i;
}
}
{
- Glib::Mutex::Lock lm2 (controllables_lock);
+ Glib::Threads::Mutex::Lock lm2 (controllables_lock);
controllables.clear ();
nlist = node.children(); // "Controls"
/* controllable */
if ((mc = create_binding (*child)) != 0) {
- Glib::Mutex::Lock lm2 (controllables_lock);
+ Glib::Threads::Mutex::Lock lm2 (controllables_lock);
controllables.push_back (mc);
}
void
GenericMidiControlProtocol::reset_controllables ()
{
- Glib::Mutex::Lock lm2 (controllables_lock);
+ Glib::Threads::Mutex::Lock lm2 (controllables_lock);
for (MIDIControllables::iterator iter = controllables.begin(); iter != controllables.end(); ) {
MIDIControllable* existingBinding = (*iter);
#define ardour_generic_midi_control_protocol_h
#include <list>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/types.h"
#include "control_protocol/control_protocol.h"
typedef std::pair<MIDIControllable*,PBD::ScopedConnection> MIDIPendingControllable;
typedef std::list<MIDIPendingControllable* > MIDIPendingControllables;
MIDIPendingControllables pending_controllables;
- Glib::Mutex controllables_lock;
- Glib::Mutex pending_lock;
+ Glib::Threads::Mutex controllables_lock;
+ Glib::Threads::Mutex pending_lock;
bool start_learning (PBD::Controllable*);
void stop_learning (PBD::Controllable*);
#include <pthread.h>
#include <boost/smart_ptr.hpp>
-#include <glibmm/thread.h>
-
#include "pbd/abstract_ui.h"
#include "midi++/types.h"
#include "ardour/types.h"
#define surface_port_h
#include <midi++/types.h>
-#include <glibmm/thread.h>
#include "pbd/signals.h"
#include "midi_byte_array.h"
#include <usb.h>
#endif
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "ardour/types.h"
#include "control_protocol/control_protocol.h"
ARDOUR::gain_t gain_fraction;
- Glib::Mutex update_lock;
+ Glib::Threads::Mutex update_lock;
std::bitset<ROWS*COLUMNS> screen_invalid;
char screen_current[ROWS][COLUMNS];
#include "ardour/types.h"
#include "control_protocol/control_protocol.h"
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include "pbd/abstract_ui.h"
}
#define ENSURE_WIIMOTE_THREAD(slot) \
- if (Glib::Thread::self() != main_thread) {\
+ if (Glib::Threads::Thread::self() != main_thread) { \
slot_mutex.lock();\
slot_list.push_back(slot);\
slot_cond.signal();\
class WiimoteControlProtocol : public ARDOUR::ControlProtocol {
- public:
- WiimoteControlProtocol (ARDOUR::Session &);
- virtual ~WiimoteControlProtocol ();
-
- static bool probe();
-
- int set_active (bool yn);
- XMLNode& get_state();
- int set_state(const XMLNode&);
-
- void wiimote_callback(cwiid_wiimote_t *, int, union cwiid_mesg [],
- struct timespec *);
-
- private:
-
- void wiimote_main();
- volatile bool main_thread_quit;
- volatile bool restart_discovery;
-
- Glib::Thread *main_thread;
-
- void update_led_state();
-
- bool callback_thread_registered_for_ardour;
-
- static uint16_t button_state;
-
- cwiid_wiimote_t *wiimote_handle;
-
- Glib::Cond slot_cond;
- Glib::Mutex slot_mutex;
-
- std::list< sigc::slot<void> > slot_list;
-
- sigc::connection transport_state_conn;
- sigc::connection record_state_conn;
+ public:
+ WiimoteControlProtocol (ARDOUR::Session &);
+ virtual ~WiimoteControlProtocol ();
+
+ static bool probe();
+
+ int set_active (bool yn);
+ XMLNode& get_state();
+ int set_state(const XMLNode&);
+
+ void wiimote_callback(cwiid_wiimote_t *, int, union cwiid_mesg [],
+ struct timespec *);
+
+ private:
+
+ void wiimote_main();
+ volatile bool main_thread_quit;
+ volatile bool restart_discovery;
+
+ Glib::Threads::Thread *main_thread;
+
+ void update_led_state();
+
+ bool callback_thread_registered_for_ardour;
+
+ static uint16_t button_state;
+
+ cwiid_wiimote_t *wiimote_handle;
+
+ Glib::Threads::Cond slot_cond;
+ Glib::Threads::Mutex slot_mutex;
+
+ std::list< sigc::slot<void> > slot_list;
+
+ sigc::connection transport_state_conn;
+ sigc::connection record_state_conn;
};