Files
goLearn/test/Consumer.go
2025-08-31 13:10:56 +08:00

20 lines
212 B
Go

package test
import (
"fmt"
"sync"
)
func GoConsumer(mx *sync.Mutex, ch chan int) {
defer mx.Unlock()
for {
select {
case v := <-ch:
mx.Lock()
fmt.Println("读取到", v)
mx.Unlock()
}
}
}