Files
goLearn/test/Consumer.go

20 lines
212 B
Go
Raw Permalink Normal View History

2025-08-31 13:10:56 +08:00
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()
}
}
}