File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
1
# 开发中
2
+
3
+ # v0.0.4
2
4
- [ slice: 重构 index 和 contains 的方法,直接调用对应Func 版本] ( https://github.com/gotomicro/ekit/pull/87 )
3
5
- [ list: 优化 ArrayList Delete 的缩容逻辑] ( https://github.com/gotomicro/ekit/pull/88 )
4
6
- [ sqlx: 加密列 EncryptColumn 支持] ( https://github.com/gotomicro/ekit/pull/92 )
5
7
6
-
7
8
# v0.0.3
8
9
- [ ekit: add ToPtr function] ( https://github.com/gotomicro/ekit/pull/6 )
9
10
- [ sqlx: 支持 JsonColumn] ( https://github.com/gotomicro/ekit/pull/7 )
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ package pool
17
17
import (
18
18
"context"
19
19
"errors"
20
+ "fmt"
21
+ "sync"
20
22
"testing"
21
23
"time"
22
24
@@ -992,3 +994,19 @@ func TestGroup(t *testing.T) {
992
994
g .delete (id )
993
995
assert .Equal (t , int32 (0 ), g .size ())
994
996
}
997
+
998
+ func ExampleNewOnDemandBlockTaskPool () {
999
+ p , _ := NewOnDemandBlockTaskPool (10 , 100 )
1000
+ _ = p .Start ()
1001
+ // wg 只是用来确保任务执行的,你在实际使用过程中是不需要的
1002
+ var wg sync.WaitGroup
1003
+ wg .Add (1 )
1004
+ _ = p .Submit (context .Background (), TaskFunc (func (ctx context.Context ) error {
1005
+ fmt .Println ("hello, world" )
1006
+ wg .Done ()
1007
+ return nil
1008
+ }))
1009
+ wg .Wait ()
1010
+ // Output:
1011
+ // hello, world
1012
+ }
You can’t perform that action at this time.
0 commit comments