13
0

Temporal: add decl for thread-local tempo map pointer

This commit is contained in:
Paul Davis 2020-08-05 16:13:32 -06:00
parent d47d462182
commit f5fad809fb
2 changed files with 5 additions and 3 deletions

View File

@ -40,6 +40,8 @@ std::string Meter::xml_node_name = X_("Meter");
superclock_t Temporal::superclock_ticks_per_second = 508032000; // 2^10 * 3^4 * 5^3 * 7^2
thread_local TempoMap::SharedPtr TempoMap::_tempo_map_p;
void
Point::add_state (XMLNode & node) const
{

View File

@ -608,11 +608,11 @@ class LIBTEMPORAL_API TempoMap : public PBD::StatefulDestructible
public:
typedef boost::shared_ptr<TempoMap> SharedPtr;
private:
static Glib::Threads::Private<SharedPtr> _tempo_map_p;
static thread_local SharedPtr _tempo_map_p;
static SerializedRCUManager<TempoMap> _map_mgr;
public:
static void update_thread_tempo_map() { SharedPtr p = _map_mgr.reader(); _tempo_map_p.set (&p); }
static SharedPtr use() { return *_tempo_map_p.get(); }
static void update_thread_tempo_map() { _tempo_map_p = _map_mgr.reader(); }
static SharedPtr use() { return _tempo_map_p; }
static SharedPtr fetch() { update_thread_tempo_map(); return use(); }
/* and now on with the rest of the show ... */