Skip to content

Commit

Permalink
+push
Browse files Browse the repository at this point in the history
  • Loading branch information
2yanyi committed Jun 8, 2022
1 parent e6967b4 commit 24f3cdf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# signalgroup

基于操作系统信号量的异步任务并行控制器。
Async work parallel controller based on system signals.

<br>

## Quick Start

```go
// 添加异步任务 work_1,后台持续运行。
// Add work_1 in background.
signalgroup.Async(func() (_ error) {
fmt.Println("work_1 ...")
for {}
})

// 添加异步任务 work_2,短暂运行后退出。
// Add work_2 keep 1s.
signalgroup.Async(func() (_ error) {
fmt.Println("work_2 ...")
time.Sleep(time.Second)
return
})

// 等待任务结束,注意!只要有一个任务退出就退出所有。
// Wait end. If one work exits, it ends all.
signalgroup.Wait(func() {
fmt.Println("<- shutdown")
return
Expand Down

0 comments on commit 24f3cdf

Please sign in to comment.