ao_write: Avoid segfault on exit.
[paraslash.git] / ao_write.c
index a2e86ed..12ab77f 100644 (file)
@@ -39,6 +39,10 @@ static void aow_close(struct writer_node *wn)
 
        if (!pawd)
                return;
+       if (pawd->thread_btrn) {
+               pthread_cancel(pawd->thread);
+               pthread_join(pawd->thread, NULL);
+       }
        ao_close(pawd->dev);
        free(pawd);
        wn->private_data = NULL;