当前位置:网站首页>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
}
边栏推荐
- Golang 使用正则来匹配出子字符串函数
- Unity3d button adapts the size according to the text content
- 小王的面试训练任务
- ICML2022 | 可扩展深度高斯马尔可夫随机场
- TypeScript学习
- 强制 20 天内开发 APP 后集体被裁,技术负责人怒批:祝“早日倒闭!”
- 100 important knowledge points that SQL must master: filtering data
- 释放开源数据库创新力量 | 【甘肃】openGauss Meetup圆满结束
- 100 important knowledge points that SQL must master: sorting and retrieving data
- Save method of JPA stepping pit series
猜你喜欢
BTC and eth recapture the lost land! Leading the market recovery? Encryption will enter the "ice age"!
Ceph分布式存储
Experience Navicat premium 16, unlimited reset, 14 day trial method (with source code)
展现强劲产品综合实力 ,2022 款林肯飞行家Aviator西南首秀
PCIE知识点-008:PCIE switch的结构
SQL Server for循环用法
Use the storcli tool to configure raid. Just collect this article
Codeforces Global Round 14
Tiktok's interest in e-commerce has hit the traffic ceiling?
Industry case | see the operation of bank digital transformation from the king of retail
随机推荐
Ceph分布式存储
于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日
DO280OpenShift访问控制--security policy和章节实验
Modify large online games through CE modifier
SQL必需掌握的100个重要知识点:创建计算字段
gomock mockgen : unknown embedded interface
Original translation | comparison of machine learning model service tools: kserve, Seldon core and bentoml
KDD 2022 | graph neural network generalization framework under the paradigm of "pre training, prompting and fine tuning"
oss上传调用的是哪个方法
Covering access to 2w+ traffic monitoring equipment, EMQ creates a new digital engine for all elements of traffic in Shenzhen
关于企业数字化的展望(38/100)
MYSQL 性能优化 index 函数,隐藏,前缀,hash 索引 使用方法(2)
关于异常处理的知识整理
富文本 考试 填空题
Prospects for enterprise digitalization (38/100)
今晚战码先锋润和赛道第2期直播丨如何参与OpenHarmony代码贡献
通过CE修改器修改大型网络游戏
行业案例|从零售之王看银行数字化转型的运营之道
Animal breeding production virtual simulation teaching system | Sinovel interactive
Go从入门到实战——package(笔记)