1. 首页
  2. 数据库
  3. 其它
  4. Go定时器、单元测试

Go定时器、单元测试

上传者: 2021-01-17 01:50:12上传 PDF文件 23.1KB 热度 16次
定时器 初始化和一般使用 t:=time.NewTicker(time.Second) for v := range t.C { fmt.Println(hello,v) } 结果:一秒输出一次 一定时间后 time.After(time.Second) select { case v := <-ch1: fmt.Println(v) case v := <-ch2: fmt.Println(v) case <-time.After(time.Second): fmt.Println(get data timeout) }
下载地址
用户评论