Skip to content

Commit

Permalink
fix: return directly if no futures
Browse files Browse the repository at this point in the history
  • Loading branch information
wunan committed Aug 21, 2024
1 parent d23fc08 commit 219bebb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ type AnyResult struct {
}

func AnyOf(fs ...*Future) *Future {
if len(fs) == 0 {
return Done(AnyResult{})
}
var counter int32
var done uint32
var errIndex int32 = -1
Expand Down Expand Up @@ -101,6 +104,9 @@ func ToAny(f *Future) *Future {
}

func AllOf(fs ...*Future) *Future {
if len(fs) == 0 {
return Done(struct{}{})
}
var done uint32
s := &state{}
c := int32(len(fs))
Expand Down

0 comments on commit 219bebb

Please sign in to comment.