Skip to content

Commit

Permalink
creational/object-pool: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
leonklingele authored and tmrts committed Jan 7, 2017
1 parent af1dfcd commit a523c5f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions creational/object-pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ package pool
type Pool chan *Object

func New(total int) *Pool {
p := make(chan *Object, total)
p := make(Pool, total)

for i := 0; i < total; i++ {
p <- new(Object)
}

return p
return &p
}
```

Expand All @@ -34,7 +34,7 @@ case obj := <-p:

p <- obj
default:
// No more objects left retry later or fail
// No more objects left retry later or fail
return
}
```
Expand All @@ -45,4 +45,4 @@ default:
expensive than the object maintenance.
- If there are spikes in demand as opposed to a steady demand, the maintenance
overhead might overweigh the benefits of an object pool.
- It has positive effects on performance due to object being initialized beforehand.
- It has positive effects on performance due to objects being initialized beforehand.

0 comments on commit a523c5f

Please sign in to comment.