Do you really need to get the Sample Rate from the thread ?
maybe you have sample rate at the start, and RARELY someone changes the rate of the system
so you get and “changeSampleRate” (or something like this)
you in the main module store the rate
float m_sr = 44100.0;
in the constructor
m_sr = APP->engine->getSampleRate()
and change it in the event:
m_sr = APP->engine->getSampleRate()
in your worker thread (assuming this is a pointer to your module