Skip to content

Commit 926d442

Browse files
authored
准备 release v0.0.4 (#99)
1 parent e876c8e commit 926d442

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

.CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# 开发中
2+
3+
# v0.0.4
24
- [slice: 重构 index 和 contains 的方法,直接调用对应Func 版本](https://github.com/gotomicro/ekit/pull/87)
35
- [list: 优化 ArrayList Delete 的缩容逻辑](https://github.com/gotomicro/ekit/pull/88)
46
- [sqlx: 加密列 EncryptColumn 支持](https://github.com/gotomicro/ekit/pull/92)
57

6-
78
# v0.0.3
89
- [ekit: add ToPtr function](https://github.com/gotomicro/ekit/pull/6)
910
- [sqlx: 支持 JsonColumn](https://github.com/gotomicro/ekit/pull/7)

pool/task_pool_test.go

+18
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ package pool
1717
import (
1818
"context"
1919
"errors"
20+
"fmt"
21+
"sync"
2022
"testing"
2123
"time"
2224

@@ -992,3 +994,19 @@ func TestGroup(t *testing.T) {
992994
g.delete(id)
993995
assert.Equal(t, int32(0), g.size())
994996
}
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+
}

0 commit comments

Comments
 (0)