(SDL2-2.0.12, Android)Cannot exit close_audio_device

The app goes into the background and exits the app, and call close_audio_device. But when SDL_WaitThread(device->thread, NULL), close_audio_device deadlocked.
static void close_audio_device(SDL_AudioDevice * device)
if (device->thread != NULL) {
// Here will deadlock, resulting in close_audio_device can not exit
SDL_WaitThread(device->thread, NULL);
As far as I’m concerned, it maybe related to openslES_WaitDevice waiting audiodata->playsem.

How to solve the problem?