Skip to content

Commit

Permalink
updated sync.RWMutex to be non pointer.
Browse files Browse the repository at this point in the history
  • Loading branch information
deankarn committed Jun 16, 2016
1 parent 688ffd6 commit 55d1cea
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package pool
============

![Project status](https://img.shields.io/badge/version-2.0.1-green.svg)
![Project status](https://img.shields.io/badge/version-2.1.0-green.svg)
[![Build Status](https://semaphoreci.com/api/v1/joeybloggs/pool/branches/v2/badge.svg)](https://semaphoreci.com/joeybloggs/pool)
[![Coverage Status](https://coveralls.io/repos/go-playground/pool/badge.svg?branch=v2&service=github)](https://coveralls.io/github/go-playground/pool?branch=v2)
[![Go Report Card](https://goreportcard.com/badge/gopkg.in/go-playground/pool.v2)](https://goreportcard.com/report/gopkg.in/go-playground/pool.v2)
Expand Down
3 changes: 1 addition & 2 deletions batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "sync"
// Batch contains all information for a batch run of WorkUnits
type Batch struct {
pool *Pool
m *sync.Mutex
m sync.Mutex
units []*WorkUnit
results chan *WorkUnit
done chan struct{}
Expand All @@ -22,7 +22,6 @@ type Batch struct {
func (p *Pool) Batch() *Batch {
return &Batch{
pool: p,
m: new(sync.Mutex),
units: make([]*WorkUnit, 0, 4), // capacity it to 4 so it doesn't grow and allocate too many times.
results: make(chan *WorkUnit),
done: make(chan struct{}),
Expand Down
3 changes: 1 addition & 2 deletions pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type Pool struct {
work chan *WorkUnit
cancel chan struct{}
closed bool
m *sync.RWMutex
m sync.RWMutex
}

// New returns a new pool instance.
Expand All @@ -88,7 +88,6 @@ func New(workers uint) *Pool {

p := &Pool{
workers: workers,
m: new(sync.RWMutex),
}

p.initialize()
Expand Down

0 comments on commit 55d1cea

Please sign in to comment.