diff options
| author | demo <demo@antix1> | 2026-05-26 18:24:16 -0400 |
|---|---|---|
| committer | demo <demo@antix1> | 2026-05-26 18:24:16 -0400 |
| commit | f7330300e912072fe8a9ec9ec372870f9ed83b03 (patch) | |
| tree | 48001923b2922ce8292200960350dbc3ccf191e7 /classic.go | |
| parent | 5cc1fc597f13c2f7c781f45b5f37169958752b04 (diff) | |
fix: release semaphore at the proper time
Diffstat (limited to 'classic.go')
| -rw-r--r-- | classic.go | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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): } }) } |
