diff --git a/README.md b/README.md index 2a8e224..1709c2c 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/batch.go b/batch.go index afb3590..5f9573b 100644 --- a/batch.go +++ b/batch.go @@ -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{} @@ -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{}), diff --git a/pool.go b/pool.go index 156bd26..66bda08 100644 --- a/pool.go +++ b/pool.go @@ -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. @@ -88,7 +88,6 @@ func New(workers uint) *Pool { p := &Pool{ workers: workers, - m: new(sync.RWMutex), } p.initialize()