None
EN
Go sync.WaitGroup and The Alignment Problem
[]
VictoriaMetrics: Simple & Reliable Monitoring for Everyone on VictoriaMetrics
type WaitGroup struct { state1 [ 12 ] byte sema uint32 } func ( wg * WaitGroup ) state () * uint64 { if uintptr ( unsafe . Add ( uint64 ( delta ) << 32 ) // Extract the counter and waiter count from the state v := int32 ( state >> 32 ) w := uint32 ( state ) ... if v < 0 { panic ( "sync: negative WaitGroup counter" ) } if w != 0 && delta > 0 && v == int32 ( delta ) { panic ( "sync: WaitGroup misuse: Add called concurrently with Wait" ) } if v > 0 || w == 0 { return } if wg . func ( wg * WaitGroup ) Wait () { ... // we excludes the race stuffs for { // Load the state of the WaitGroup state := wg .