当前位置:网站首页>Golang waits for a group of goroutines to complete with the return value (2)
Golang waits for a group of goroutines to complete with the return value (2)
2022-07-27 18:10:00 【gitxuzan_】
// https://github.com/AaronJan/Hunch
ctx := context.Background()
r, err := hunch.All(
ctx,
func(ctx context.Context) (interface{
}, error) {
time.Sleep(300 * time.Millisecond)
return 1, nil
},
func(ctx context.Context) (interface{
}, error) {
time.Sleep(200 * time.Millisecond)
return 2, nil
},
func(ctx context.Context) (interface{
}, error) {
time.Sleep(100 * time.Millisecond)
return 3, nil
},
)
fmt.Println(r, err)
// Output
// [1 2 3] <nil>
边栏推荐
- golang chan实现互斥锁
- Error launching IDEA
- mysql解决唯一索引重复导致的插入失败问题
- Big gap? Requirements and conditions for candidates with different academic qualifications to take the postgraduate entrance examination
- [MCU] 2.3 CPU of AT89S52
- JS to realize the right-click menu bar function
- Operation of simulated examination platform for 2022 low voltage electrician examination questions
- In the fourth week of July, Yidun business risk control focused on the supreme law to regulate app's forcible request for personal information
- Bug records using distributed framework WCF
- org.gradle.api.UncheckedIOException: Could not load properties for module ‘gradle-kotlin-dsl‘ from C
猜你喜欢

7月第4周易盾业务风控关注 | 最高法对APP强索个人信息进行规制

使用分布式框架WCF出现的BUG记录

vue使用keep-alive实现页面缓存

知物由学 | 从0到1搭建实时反外挂机制,多维度补充手游攻防力

Convolutional neural network -- SSD thesis translation

JDBC connection database reading foreground cannot display data

What's the use of games| Game application value research case collection

In the fourth week of July, Yidun business risk control focused on the supreme law to regulate app's forcible request for personal information

EF框架简介

Notes on standardized management of "ancestral warehouse" of meituan meal
随机推荐
Detailed explanation of browser caching mechanism
卷积神经网络——FPN(Feature Pyramid Networks)介绍
Oracle 11g database installation tutorial
With the right tools, CI achieves twice the result with half the effort
Are those who are absent from the written examination shortlisted for the teacher recruitment interview? Henan Xiangfu: the statistics of individual candidates' scores are wrong
知物由学 | 从0到1搭建实时反外挂机制,多维度补充手游攻防力
fragmentTransaction.replace第二个参数报错
Prevent SQL injection
ts学习笔记-interface
Behind every piece of information you collect, you can't live without TA
@Scheduled 和Quartz
What's the use of games| Game application value research case collection
wallys/DR882-Qualcomm-Atheros-QCA9882-2T2R-MIMO-802.11ac-Mini-PCIe-Wi-Fi-Module-5G-high-power.
hutool- 数字计算
Configuration and basic use of vim
In the fourth week of July, Yidun business risk control focused on the supreme law to regulate app's forcible request for personal information
Machine learning: IOU of concept understanding
机器学习——概念理解之IoU
卷积神经网络之卷积计算过程个人理解
备份表恢复表