当前位置:网站首页>Go from introduction to actual combat - all tasks completed (notes)
Go from introduction to actual combat - all tasks completed (notes)
2022-06-27 21:37:00 【Accumulated Ytu】
func runTask(id int) string {
time.Sleep(10 * time.Millisecond)
return fmt.Sprintf("The result is from %d", id)
}
func FirstResponse() string {
numOfRunner := 10
ch := make(chan string, numOfRunner)
for i := 0; i < numOfRunner; i++ {
go func(i int) {
ret := runTask(i)
ch <- ret
}(i)
}
finalRet := ""
for i := 0; i < numOfRunner; i++ {
finalRet += <-ch + "\n"
}
return finalRet
}
边栏推荐
猜你喜欢

Covering access to 2w+ traffic monitoring equipment, EMQ creates a new digital engine for all elements of traffic in Shenzhen

100 important knowledge points that SQL must master: filtering data

Zhongang Mining: the largest application field of new energy or fluorite

GFS分布式文件系统

使用storcli工具配置RAID,收藏这一篇就够了

Codeforces Global Round 14

Wechat applet based service management system for college party members' Home System applet graduation design, Party members, activists, learning, punch in, forum

SQL必需掌握的100个重要知识点:使用函数处理数据

微服务之远程调用

Tiktok's interest in e-commerce has hit the traffic ceiling?
随机推荐
抖音的兴趣电商已经碰到流量天花板?
实际工作中用到的shell命令 - sed
Love math experiment | Issue 8 - building of Singapore house price prediction model
Love math experiment | phase VI - Financial anti fraud case study
SQL必需掌握的100个重要知识点:使用函数处理数据
Shell command used in actual work - sed
MySQL performance optimization index function, hidden, prefix, hash index usage (2)
uniapp拦截请求
MySQL Express - day 1 - basic introduction
100 important knowledge points that SQL must master: creating calculation fields
OpenSSL 编程 一:基本概念
Ceph分布式存储
Contest 2050 and Codeforces Round #718 (Div. 1 + Div. 2)
Tutorial | fNIRS data processing toolkit homer2 download and installation
Codeforces Round #722 (Div. 2)
Zhongang Mining: the largest application field of new energy or fluorite
SQL必需掌握的100个重要知识点:创建计算字段
100 important knowledge points that SQL must master: filtering data
ABC-Teleporter Setting-(思维+最短路)
送你12个常用函数公式,用过的都说好