go test -count 1 -timeout 5s -v -race github.com/qydysky/part/component
go test -count 1 -timeout 15s -v -race github.com/qydysky/part/ctx
go test -count 1 -timeout 5s -v -race github.com/qydysky/part/slice
+ go test -count 1 -timeout 5s -v -race github.com/qydysky/part/bools
u-test:
name: u-test
go test -count 1 -timeout 5s -v -race github.com/qydysky/part/component
go test -count 1 -timeout 15s -v -race github.com/qydysky/part/ctx
go test -count 1 -timeout 5s -v -race github.com/qydysky/part/slice
+ go test -count 1 -timeout 5s -v -race github.com/qydysky/part/bools
test:
name: test
echo "HASH=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
- name: Upload a Release Asset
- uses: softprops/action-gh-release@v1
+ uses: softprops/action-gh-release@v2
with:
tag_name: v0.28.${{ env.TIME }}
\ No newline at end of file
t.n.Add(-1)
}
+func (t *BlockFuncN) BlockF(failF ...func()) (unBlock func(failF ...func())) {
+ t.Block(failF...)
+ return t.UnBlock
+}
+
func (t *BlockFuncN) BlockAll(failF ...func()) {
for !t.n.CompareAndSwap(0, -1) {
for i := 0; i < len(failF); i++ {
}
}
-func (t *BlockFuncN) UnBlockAll() {
- if !t.n.CompareAndSwap(-1, 0) {
- panic("must BlockAll First")
+func (t *BlockFuncN) UnBlockAll(failF ...func()) {
+ for !t.n.CompareAndSwap(-1, 0) {
+ for i := 0; i < len(failF); i++ {
+ failF[i]()
+ }
+ runtime.Gosched()
}
}
+
+func (t *BlockFuncN) BlockAllF(failF ...func()) (unBlock func(failF ...func())) {
+ t.BlockAll(failF...)
+ return t.UnBlockAll
+}