Documentation
¶
Overview ¶
Example ¶
package main
import (
"fmt"
"time"
"codeberg.org/FedericoSchonborn/go-sandbox/task"
)
func main() {
waitOneSecondAndReturnFive := func() int {
time.Sleep(1 * time.Second)
return 5
}
fmt.Println(task.New(waitOneSecondAndReturnFive).Join())
}
Output: 5
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Join ¶
Example ¶
package main
import (
"fmt"
"math/rand"
"time"
"codeberg.org/FedericoSchonborn/go-sandbox/task"
)
func main() {
rand.Seed(time.Now().Unix())
returnSix := func() int {
return 6
}
handles := make([]*task.Handle[int], 10)
for i := 0; i < 10; i++ {
handles[i] = task.New(returnSix)
}
fmt.Println(task.Join(handles...))
}
Output: [6 6 6 6 6 6 6 6 6 6]
Types ¶
Click to show internal directories.
Click to hide internal directories.