博客
关于我
channel实现 pthread_cond_signal() 等待通知机制
阅读量:260 次
发布时间:2019-03-01

本文共 260 字,大约阅读时间需要 1 分钟。

package mainimport (	"fmt"	"time")func main() {	ch := make(chan struct{})	nums := make([]int, 10)	go func() {		time.Sleep(time.Second * 5)		for i := 0; i < len(nums); i++ {			nums[i] = i		}		ch <- struct{}{}	}()	<-ch	fmt.Println(nums)}/*[0 1 2 3 4 5 6 7 8 9]*/

 

转载地址:http://leaa.baihongyu.com/

你可能感兴趣的文章