Skip to content

Commit

Permalink
Updated Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tejzpr authored Nov 22, 2021
1 parent f260933 commit d0ecbec
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ A library for parallel processing with ordered output in Go. This module process
# Usage
## Get Module
```go
go get github.com/tejzpr/ordered-concurrently/v2
go get github.com/tejzpr/ordered-concurrently/v3
```
## Import Module in your source code
```go
import concurrently "github.com/tejzpr/ordered-concurrently/v2"
import concurrently "github.com/tejzpr/ordered-concurrently/v3"
```
## Create a work function by implementing WorkFunction interface
```go
Expand All @@ -34,7 +34,8 @@ func (w loadWorker) Run() interface{} {
func main() {
max := 10
inputChan := make(chan concurrently.WorkFunction)
output := concurrently.Process(inputChan, &concurrently.Options{PoolSize: 10, OutChannelBuffer: 10})
ctx := context.Background()
output := concurrently.Process(ctx, inputChan, &concurrently.Options{PoolSize: 10, OutChannelBuffer: 10})
go func() {
for work := 0; work < max; work++ {
inputChan <- loadWorker(work)
Expand All @@ -50,7 +51,8 @@ func main() {
```go
func main() {
inputChan := make(chan concurrently.WorkFunction, 10)
output := concurrently.Process(inputChan, &concurrently.Options{PoolSize: 10, OutChannelBuffer: 10})
ctx := context.Background()
output := concurrently.Process(ctx, inputChan, &concurrently.Options{PoolSize: 10, OutChannelBuffer: 10})

ticker := time.NewTicker(100 * time.Millisecond)
done := make(chan bool)
Expand Down

0 comments on commit d0ecbec

Please sign in to comment.