当前位置:网站首页>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
}
边栏推荐
- JPA踩坑系列之save方法
- 关于企业数字化的展望(38/100)
- ICML2022 | 可扩展深度高斯马尔可夫随机场
- Unity3d button adapts the size according to the text content
- SQL必需掌握的100个重要知识点:过滤数据
- Data platform scheduling upgrade and transformation | operation practice from Azkaban smooth transition to Apache dolphin scheduler
- 100 important knowledge points that SQL must master: creating calculation fields
- 通过CE修改器修改大型网络游戏
- 系统自带的karsonzhang/fastadmin-addons报错
- 100 important knowledge points for SQL: in operator
猜你喜欢

Show the comprehensive strength of strong products, and make the first show of 2022 Lincoln aviator in Southwest China

100 important knowledge points that SQL must master: sorting and retrieving data

MySQL usage notes 1

今晚战码先锋润和赛道第2期直播丨如何参与OpenHarmony代码贡献

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

CEPH distributed storage

白嫖红队goby&POC,叫你如何白嫖?

于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日

Flexible IP network test tool -- x-launch

College graduation thesis management system based on wechat applet graduation design
随机推荐
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?
Modify large online games through CE modifier
KDD 2022 | 图“预训练、提示、微调”范式下的图神经网络泛化框架
CORBA 架构体系指南(通用对象请求代理体系架构)
划重点!国产电脑上安装字体小技巧
如何将队列里面的内容没秒钟执行一次优先级
Show the comprehensive strength of strong products, and make the first show of 2022 Lincoln aviator in Southwest China
非常全面的DolphinScheduler(海豚调度)安装使用文档
Cerebral Cortex:从任务态和静息态脑功能连接预测儿童数学技能
2021全球独角兽榜发布:中国301家独角兽企业全名单来了!
Necessary software tools in embedded software development
Tutorial | fNIRS data processing toolkit homer2 download and installation
DO280OpenShift访问控制--security policy和章节实验
Acwing周赛57-最长连续子序列-(二分or树状数组)
Navicat Premium连接问题--- Host ‘xxxxxxxx‘ is not allowed to connect to this MySQL server
爱数课实验 | 第七期-基于随机森林的金融危机分析
Flood fighting and disaster relief, overcoming difficulties, and City United premium products rushed to the aid of Yingde to donate loving materials
Kirin V10 installation font
Share an experience of self positioning + problem solving
数据平台调度升级改造 | 从Azkaban 平滑过度到Apache DolphinScheduler 的操作实践