summaryrefslogtreecommitdiff
path: root/classic.go
diff options
context:
space:
mode:
authordemo <demo@antix1>2026-05-26 18:24:16 -0400
committerdemo <demo@antix1>2026-05-26 18:24:16 -0400
commitf7330300e912072fe8a9ec9ec372870f9ed83b03 (patch)
tree48001923b2922ce8292200960350dbc3ccf191e7 /classic.go
parent5cc1fc597f13c2f7c781f45b5f37169958752b04 (diff)
fix: release semaphore at the proper time
Diffstat (limited to 'classic.go')
-rw-r--r--classic.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/classic.go b/classic.go
index bb22b0b..0b2bfa8 100644
--- a/classic.go
+++ b/classic.go
@@ -40,12 +40,13 @@ loop:
numPendingSends++
wg.Go(func() {
+ sema <- struct{}{}
+ defer func() { <-sema }()
+
select {
case <-ctx.Done():
return
- case sema <- struct{}{}:
- defer func() { <-sema }()
- worklist <- getBatch(u)
+ case worklist <- getBatch(u):
}
})
}