You should set `worker_running = TRUE` after thread creation succeds in `session_start_async`.
To elaborate: the worker thread does not own `worker_running`. If another thread sets it to `FALSE` before the worker thread could enter the critical section, the stop request will be ignored and the `StopAsync` caller will hang.