Move readme parts to their corresponding packages

This commit is contained in:
2018-07-03 20:33:55 +02:00
parent b4e6729fb0
commit 993153693a
6 changed files with 148 additions and 114 deletions
+22
View File
@@ -0,0 +1,22 @@
## Thread pool
Package `thread_pool` implements a pool of threads, duh.
```go
import "github.com/localhots/gobelt/threadpool"
```
```go
ctx := context.Background()
ctx, cancel = context.WithTimeout(ctx, 30*time.Second)
defer cancel()
pool := threadpool.New(10)
defer pool.Close()
for i := 0; i < 1000000; i++ {
i := i
pool.Enqueue(ctx, func() {
fmt.Printf("The number is %d\n", i)
})
}
```