3 ms·
> but goroutine B (the goroutineB function) apparently never ran at all. Untrue. Up the iterations to 1000, you'll get your interleaving. Since 1.14, goroutine
by cabirum 1y ago
> but goroutine B (the goroutineB function) apparently never ran at all.
Untrue. Up the iterations to 1000, you'll get your interleaving. Since 1.14, goroutines are async preemptible (async safe points), and will not block the scheduler.
Also, time.Sleep bad, use runtime.Gosched().
- semv3r 1y agotime.Sleep bad? Grug no understand.