当前位置:网站首页>golang goroutine、channel、time代码示例
golang goroutine、channel、time代码示例
2022-06-23 15:38:00 【学亮编程手记】
golang goroutine、channel、time代码示例
package main
import (
"time"
"fmt"
)
func timenow(ch chan string) {
tn := time.Now().Format("2006年01月02日 15点04分05秒.0000000 时区-0700")
ch <-tn
}
func main (){
ch:=make(chan string)
for i:=0;i<10;i++ {
go timenow(ch)
fmt.Println(<-ch)
time.Sleep(500*time.Millisecond)
}
}
/* ################ 运行结果 ################## PS D:\golang\github\golang_project\go实现的案例demo\goroutine、channel、time的例子> go run .\goroutine+channel+time.go 2020年08月10日 10点19分27秒.2609770 时区+0800 2020年08月10日 10点19分27秒.7786030 时区+0800 2020年08月10日 10点19分28秒.2792588 时区+0800 2020年08月10日 10点19分28秒.7794479 时区+0800 2020年08月10日 10点19分29秒.2805396 时区+0800 2020年08月10日 10点19分29秒.7809675 时区+0800 2020年08月10日 10点19分30秒.2814328 时区+0800 2020年08月10日 10点19分30秒.7820869 时区+0800 2020年08月10日 10点19分31秒.2829391 时区+0800 2020年08月10日 10点19分31秒.7834190 时区+0800 */
边栏推荐
- freemark 使用ftl文件 生成word
- Tableau comparatif du nom de la clé ADB, du numéro du Code de la clé et de la description de la clé
- js 对象 使用小技巧
- Chapitre Web 01 comprendre le développement web
- [tcapulusdb knowledge base] Introduction to tmonitor stand-alone installation guidelines (II)
- js中 if 直接判断 数据类型 结果举例
- Log4J日志整合及配置详解
- Can the hbuilderx light theme be annotated?
- If no code is moved, the project access speed drops significantly the next day. Case analysis
- 六石编程学:运用之妙,存乎一心
猜你喜欢

stylegan3:alias-free generative adversarial networks

《Apache Commons 工具类》

513. Find Bottom Left Tree Value

【TcaplusDB知识库】TcaplusDB Tmonitor模块架构介绍
NLP 论文领读|改善意图识别的语义表示:有监督预训练中的各向同性正则化方法

Advanced development - generic entry basic class test
![[tcapulusdb knowledge base] Introduction to tmonitor background one click installation (I)](/img/d7/3a514fb75b3df487914a8db245ab89.png)
[tcapulusdb knowledge base] Introduction to tmonitor background one click installation (I)

matlab: 如何从一些数据里知道是由哪些数据相加得出一个已知数

Sleuth + Zipkin

阻塞、非阻塞、多路复用、同步、异步、BIO、NIO、AIO 一文搞定
随机推荐
A tour of gRPC:01 - 基础理论
六石编程学:运用之妙,存乎一心
阻塞、非阻塞、多路复用、同步、异步、BIO、NIO、AIO 一文搞定
Spin lock using CAS
[tcapulusdb knowledge base] Introduction to tmonitor background one click installation (I)
get_edges
证券开户的优惠怎样才能得到?在线开户安全么?
图片读取:Image.open(ImgPath)
线程池
readImg: 读取图片到Variable变量
OpenResty 基础
Sleuth + Zipkin
CA authentication and issuance of revocation certificates
创建好后的模型,对Con2d, ConvTranspose2d ,以及归一化BatchNorm2d函数中的变量进行初始化
js 递归json树 根据 子id 查 父id
进阶开发阶段-势若悬丝的加粗开始. 现在的一小步,明年的一大步
【TcaplusDB知识库】Tmonitor系统升级介绍
Does the enterprise want to use the MES system? These conditions have to be met
golang冒泡排序代码实现
PageHelper faces the paging problem of complex service data processing