ref: e13af7f16f7c632d653222d58a61b2945ffe1da7
parent: b25f9d624d037d6dc7eb1e0762cfbd941cb99ffa
author: kvik <kvik@a-b.xyz>
date: Thu Nov 1 12:12:22 EDT 2018
don't wakeup wgwait unless it can continue
--- a/clone.c
+++ b/clone.c
@@ -114,11 +114,11 @@
void
wgdone(WaitGroup *wg)
{
- if(decref(wg) < 0)
- sysfatal("wgdone: negative WaitGroup count");
- qlock(wg);
- rwakeupall(wg);
- qunlock(wg);
+ if(decref(wg) == 0){
+ qlock(wg);
+ rwakeupall(wg);
+ qunlock(wg);
+ }
}
void
@@ -125,11 +125,10 @@
wgwait(WaitGroup *wg)
{
qlock(wg);
- while(!(wg->ref == 0))
+ while(wg->ref != 0)
rsleep(wg);
qunlock(wg);
}
-
char *
filename(char *s)