shithub: pplay

Download patch

ref: 659f55ffe075fb4e80c6988076fbb083ba1352e6
parent: 7ce3aecba011c42b3ae9e13230110dc73fa48a28
author: qwx <[email protected]>
date: Sun Nov 20 08:56:14 EST 2022

and also fix last commit

--- a/draw.c
+++ b/draw.c
@@ -5,7 +5,7 @@
 #include "dat.h"
 #include "fns.h"
 
-QLock synclock;
+QLock lsync;
 
 enum{
 	Cbg,
@@ -86,18 +86,18 @@
 		m = viewe - views;
 		x = 0;
 		while(m > 0){
-			qlock(&synclock);
+			qlock(&lsync);
 			if(nbrecvul(drawc) == 1){
-				qunlock(&synclock);
+				qunlock(&lsync);
 				goto again;
 			}
 			n = m < T ? m : T;
-			if((p = getbuf(d, n, sbuf, &n)) == nil){
-				qunlock(&synclock);
+			p = getbuf(d, n, sbuf, &n);
+			qunlock(&lsync);
+			if(p == nil){
 				fprint(2, "getbuf: %r\n");
 				goto end;
 			}
-				qunlock(&synclock);
 			d.pos += n;
 			e = p + n;
 			lmin = lmax = 0;
--- a/pplay.c
+++ b/pplay.c
@@ -7,7 +7,7 @@
 #include "dat.h"
 #include "fns.h"
 
-extern QLock synclock;
+extern QLock lsync;
 
 int stereo, zoom = 1;
 int debug;
@@ -153,7 +153,7 @@
 			default:
 				if((p = prompt(r)) == nil || strlen(p) == 0)
 					break;
-				qlock(&synclock);
+				qlock(&lsync);
 				switch(cmd(p)){
 				case -1: fprint(2, "cmd \"%s\" failed: %r\n", p); break;
 				case 0: update(); break;
@@ -160,7 +160,7 @@
 				case 1: redraw(0); break;
 				case 2: redraw(1); break;
 				}
-				qunlock(&synclock);
+				qunlock(&lsync);
 			}
 		}
 	}