From f5fad809fb6d7d9091e03d8ad99c7fc626a18cf7 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 5 Aug 2020 16:13:32 -0600 Subject: [PATCH] Temporal: add decl for thread-local tempo map pointer --- libs/temporal/tempo.cc | 2 ++ libs/temporal/temporal/tempo.h | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/temporal/tempo.cc b/libs/temporal/tempo.cc index 849bf30160..61371cadba 100644 --- a/libs/temporal/tempo.cc +++ b/libs/temporal/tempo.cc @@ -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 { diff --git a/libs/temporal/temporal/tempo.h b/libs/temporal/temporal/tempo.h index cccc8ce5c0..daf3294d93 100644 --- a/libs/temporal/temporal/tempo.h +++ b/libs/temporal/temporal/tempo.h @@ -608,11 +608,11 @@ class LIBTEMPORAL_API TempoMap : public PBD::StatefulDestructible public: typedef boost::shared_ptr SharedPtr; private: - static Glib::Threads::Private _tempo_map_p; + static thread_local SharedPtr _tempo_map_p; static SerializedRCUManager _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 ... */