摘要:
import ( "fmt" "math/rand" "sync" "time" ) type Buffer struct { mutex sync.Mutex notEmpty *sync.Cond buff []int } func NewBuffer() *Buffer { buf := Bu 阅读全文
posted @ 2025-03-31 15:37
seonwee
阅读(6)
评论(0)
推荐(0)
摘要:
1. 使用channel控制 func main() { wg := sync.WaitGroup{} c1 := make(chan struct{}, 1) c2 := make(chan struct{}, 0) wg.Add(2) c1 <- struct{}{} go func() { f 阅读全文
posted @ 2025-03-31 15:20
seonwee
阅读(99)
评论(0)
推荐(0)

浙公网安备 33010602011771号