当前位置:网站首页>Go从入门到实战——所有任务完成(笔记)
Go从入门到实战——所有任务完成(笔记)
2022-06-27 19:22:00 【积淀 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
}
边栏推荐
- Educational Codeforces Round 108 (Rated for Div. 2)
- OpenSSL 编程 二:搭建 CA
- SQL必需掌握的100个重要知识点:用通配符进行过滤
- 如何将队列里面的内容没秒钟执行一次优先级
- Codeforces Round #716 (Div. 2)
- White whoring red team goby & POC, how do you call white whoring?
- 麒麟V10安装字体
- After being forced to develop the app within 20 days, the group was laid off, and the technical director angrily criticized it: I wish "closure as soon as possible!"
- Oracle的CTAS能不能将约束等属性带到新表?
- 白嫖红队goby&POC,叫你如何白嫖?
猜你喜欢

展现强劲产品综合实力 ,2022 款林肯飞行家Aviator西南首秀

让马化腾失望了!Web3.0,毫无希望

MYSQL 性能优化 index 函数,隐藏,前缀,hash 索引 使用方法(2)

MySQL performance optimization index function, hidden, prefix, hash index usage (2)

富文本 考试 填空题

GoLand永久激活

308. 2D area and retrieval - variable segment tree / hash

Icml2022 | scalable depth Gaussian Markov random field

squid代理服務器

College graduation thesis management system based on wechat applet graduation design
随机推荐
MySQL Express - day 1 - basic introduction
划重点!国产电脑上安装字体小技巧
SQL必需掌握的100个重要知识点:创建计算字段
展现强劲产品综合实力 ,2022 款林肯飞行家Aviator西南首秀
Save method of JPA stepping pit series
实际工作中用到的shell命令 - sed
White whoring red team goby & POC, how do you call white whoring?
GoLand永久激活
Safe and efficient, non-contact "hand brushing" identification helps epidemic prevention and control
安装gatewayworker之后启动start.php
This is the same as data collection. Can you define a parameter as last month or the previous day, and then use this parameter in SQL?
事件相关电位ERP的皮层溯源分析
富文本 考试 填空题
Open a new ecological posture | use the wrodpress remote attachment to store it in COS
Let Ma Huateng down! Web3.0, hopeless
Is it safe to open an account and buy stocks on the Internet? New to stocks, no guidance
Tutorial | fNIRS data processing toolkit homer2 download and installation
SQL必需掌握的100个重要知识点:IN 操作符
squid代理服务器
Educational Codeforces Round 108 (Rated for Div. 2)