ref: e5943318dd3d95f0a7dd03122cbb003ab59f9633
parent: 0976218b5053b413e631c794b6d4b1918ad4dd78
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Feb 1 00:19:25 EST 2022
blk: fix excessive cleverness in sync we're not throwing a ton of syncs down the channels, so just take the damn lock instead of messing with atomics.
--- a/blk.c
+++ b/blk.c
@@ -985,11 +985,10 @@
while(q.nheap < q.heapsz){
b = chrecv(c, q.nheap == 0);
if(b == &magic){
- if(adec(&fs->syncing) == 0){
- qlock(&fs->synclk);
+ qlock(&fs->synclk);
+ if(--fs->syncing == 0)
rwakeupall(&fs->syncrz);
- qunlock(&fs->synclk);
- }
+ qunlock(&fs->synclk);
continue;
}
if(b != nil)