Threading & Lifetime Rules - Sanas Developer Hub
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
- All SDK methods are thread-safe. You may call them from multiple threads simultaneously.
- Callbacks (
onState,onTranscript) run on background threads managed by the SDK. Keep them fast, non-blocking, and synchronised — usestd::atomicorstd::mutexfor any shared state they touch. ProcessSamplesblocks for one frame while the SDK reads processed audio from its internal buffer. Call it from your audio thread, not from inside a callback.- Keep the
shared_ptr<IAudioProcessor>alive for as long as you use the processor. CallDestroyAudioProcessorwhen done, thenShutdownlast.
Never call DestroyAudioProcessor or Shutdown from inside an onState or onTranscript callback. Doing so causes a deadlock.