Add mutex lock for global variables in tts_client.c