Skip to content

Commit 21edb94

Browse files
authored
Update simple.go
1 parent ef42611 commit 21edb94

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/simple.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ import (
77
)
88

99
func main() {
10-
fmt.Println("program running.")
1110

11+
// 添加异步任务 work_1,后台持续运行。
1212
siggroup.Async(func() {
1313
fmt.Println("work_1 ...")
14-
for {
15-
}
14+
for {}
1615
})
1716

17+
// 添加异步任务 work_2,短暂运行后退出。
1818
siggroup.Async(func() {
1919
fmt.Println("work_2 ...")
2020
time.Sleep(time.Second)
2121
})
2222

23-
// wait.
23+
// 等待任务结束,注意!只要有一个任务退出就退出所有。
2424
siggroup.Wait(func() {
25-
fmt.Println("program shutdown.")
25+
fmt.Println(":shutdown")
2626
})
2727
}

0 commit comments

Comments
 (0)