From b109a0338c03b28e3d6b23bb7c54cb9853b71ffa Mon Sep 17 00:00:00 2001 From: Daniel Hu Date: Thu, 27 Jul 2023 13:33:39 +0800 Subject: [PATCH] Update task examples in README.md and README_zh.md - 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 --- README.md | 9 ++++++--- README_zh.md | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 90b082e..bc4f237 100644 --- a/README.md +++ b/README.md @@ -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() @@ -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() @@ -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() diff --git a/README_zh.md b/README_zh.md index d6f92be..e219d8f 100644 --- a/README_zh.md +++ b/README_zh.md @@ -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() @@ -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() @@ -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()