Skip to content

Commit

Permalink
Update task examples in README.md and README_zh.md
Browse files Browse the repository at this point in the history
- Updated the task examples in README.md and README_zh.md to return a result and an error.
- This change reflects the updated task signature in GoPool.

Signed-off-by: Daniel Hu <tao.hu@merico.dev>
  • Loading branch information
daniel-hutao committed Jul 27, 2023
1 parent d61e43f commit b109a03
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions README.md
Expand Up @@ -72,8 +72,9 @@ func main() {
defer pool.Release()

for i := 0; i < 1000; i++ {
pool.AddTask(func() {
pool.AddTask(func() (interface{}, error){
time.Sleep(10 * time.Millisecond)
return nil, nil
})
}
pool.Wait()
Expand All @@ -97,8 +98,9 @@ func main() {
defer pool.Release()

for i := 0; i < 1000; i++ {
pool.AddTask(func() {
pool.AddTask(func() (interface{}, error){
time.Sleep(10 * time.Millisecond)
return nil, nil
})
}
pool.Wait()
Expand All @@ -125,8 +127,9 @@ func main() {
defer pool.Release()

for i := 0; i < 1000; i++ {
pool.AddTask(func() {
pool.AddTask(func() (interface{}, error){
time.Sleep(10 * time.Millisecond)
return nil, nil
})
}
pool.Wait()
Expand Down
9 changes: 6 additions & 3 deletions README_zh.md
Expand Up @@ -72,8 +72,9 @@ func main() {
defer pool.Release()

for i := 0; i < 1000; i++ {
pool.AddTask(func() {
pool.AddTask(func() (interface{}, error){
time.Sleep(10 * time.Millisecond)
return nil, nil
})
}
pool.Wait()
Expand All @@ -97,8 +98,9 @@ func main() {
defer pool.Release()

for i := 0; i < 1000; i++ {
pool.AddTask(func() {
pool.AddTask(func() (interface{}, error){
time.Sleep(10 * time.Millisecond)
return nil, nil
})
}
pool.Wait()
Expand All @@ -125,8 +127,9 @@ func main() {
defer pool.Release()

for i := 0; i < 1000; i++ {
pool.AddTask(func() {
pool.AddTask(func() (interface{}, error){
time.Sleep(10 * time.Millisecond)
return nil, nil
})
}
pool.Wait()
Expand Down

0 comments on commit b109a03

Please sign in to comment.