Skip to content

Commit

Permalink
Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
marusama committed Jan 30, 2018
1 parent b2c2d23 commit 134dab2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Expand Up @@ -42,14 +42,14 @@ wg := sync.WaitGroup{}
for i := 0; i < 10; i++ { // create 10 goroutines (the same count as barrier parties)
wg.Add(1)
go func() {
for j := 0; j < 100; j++ {
for j := 0; j < 5; j++ {

// do some hard work 100 times
// do some hard work 5 times
time.Sleep(100 * time.Millisecond)

err := b.Await(ctx) // ..and wait on the barrier other parties.
// Last arrived goroutine will do the barrier action
// and then pass all other goroutines to the next round
err := b.Await(context.TODO()) // ..and wait for other parties on the barrier.
// Last arrived goroutine will do the barrier action
// and then pass all other goroutines to the next round
if err != nil {
panic(err)
}
Expand All @@ -59,7 +59,7 @@ for i := 0; i < 10; i++ { // create 10 goroutines (the same count as b
}

wg.Wait()
fmt.Println(cnt) // cnt = 100, it means that the barrier was passed 100 times
fmt.Println(cnt) // cnt = 5, it means that the barrier was passed 5 times
```

For more documentation see https://godoc.org/github.com/marusama/cyclicbarrier

0 comments on commit 134dab2

Please sign in to comment.