shithub: qk1

Download patch

ref: 313e885fc70220de258ee589d43356e16790287a
parent: c1d7ea02c5c1be39e41a1fa19d43212269ef2be5
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Nov 7 16:44:30 EST 2023

sndstop (plan9): wait until the proc exits

--- a/snd_plan9.c
+++ b/snd_plan9.c
@@ -4,6 +4,7 @@
 static int afd;
 static QLock alock;
 static uchar *mixbuf;
+static Channel *ach;
 
 static void
 auproc(void *p)
@@ -28,6 +29,13 @@
 void
 sndstop(void)
 {
+	if(ach != nil){
+		qlock(&alock);
+		mixbuf = nil;
+		sendul(ach, 0);
+		qunlock(&alock);
+		ach = nil;
+	}
 	close(afd);
 	afd = -1;
 }
@@ -35,8 +43,6 @@
 void
 sndwrite(uchar *buf, long sz)
 {
-	static Channel *ach;
-
 	if(afd < 0 && sndopen() < 0)
 		return;
 	if(ach == nil){