This guarantees the play thread is not active any more in aow_close().
if (!pawd)
return;
- if (pawd->thread_btrn) {
- pthread_cancel(pawd->thread);
- pthread_join(pawd->thread, NULL);
- }
+ assert(!pawd->thread_btrn);
ao_close(pawd->dev);
free(pawd);
wn->private_data = NULL;
return 0;
}
if (!wn->btrn) {
- if (!pawd->thread_btrn)
+ if (!pawd->thread_btrn) {
+ pthread_join(pawd->thread, NULL);
return -E_AO_EOF;
+ }
PARA_INFO_LOG("waiting for play thread to terminate\n");
return 0;
}