13
0

set thread-local variable infrastructure for process thread & process graph

This commit is contained in:
Paul Davis 2020-11-19 22:16:42 -07:00
parent 772d70ae4c
commit c9055547f3
4 changed files with 24 additions and 0 deletions

View File

@ -139,6 +139,8 @@ private:
/* engine / thread connection */
PBD::ScopedConnectionList engine_connections;
void engine_stopped ();
void setup_thread_local_variables ();
};
} // namespace

View File

@ -2284,6 +2284,8 @@ private:
std::string unnamed_file_name () const;
GATOMIC_QUAL gint _update_pretty_names;
void setup_thread_local_variables ();
};

View File

@ -27,6 +27,8 @@
#include "pbd/debug_rt_alloc.h"
#include "pbd/pthread_utils.h"
#include "temporal/superclock.h"
#include "ardour/audioengine.h"
#include "ardour/debug.h"
#include "ardour/graph.h"
@ -467,6 +469,7 @@ Graph::helper_thread ()
pt->get_buffers ();
while (!g_atomic_int_get (&_terminate)) {
setup_thread_local_variables ();
run_one ();
}
@ -520,6 +523,7 @@ again:
/* After setup, the main-thread just becomes a normal worker */
while (!g_atomic_int_get (&_terminate)) {
setup_thread_local_variables ();
run_one ();
}
@ -527,6 +531,12 @@ again:
delete (pt);
}
void
Graph::setup_thread_local_variables ()
{
Temporal::_thread_sample_rate = _session.sample_rate ();
}
void
Graph::dump (int chain) const
{

View File

@ -35,6 +35,8 @@
#include <glibmm/threads.h>
#include "temporal/superclock.h"
#include "ardour/audioengine.h"
#include "ardour/auditioner.h"
#include "ardour/butler.h"
@ -67,6 +69,12 @@ using namespace std;
#define TFSM_LOCATE(target,ltd,loop,force) { _transport_fsm->enqueue (new TransportFSM::Event (TransportFSM::Locate,target,ltd,loop,force)); }
void
Session::setup_thread_local_variables ()
{
Temporal::_thread_sample_rate = sample_rate();
}
/** Called by the audio engine when there is work to be done with JACK.
* @param nframes Number of samples to process.
*/
@ -78,6 +86,8 @@ Session::process (pframes_t nframes)
samplepos_t transport_at_start = _transport_sample;
setup_thread_local_variables ();
_silent = false;
if (processing_blocked()) {