mirror of https://github.com/jlelse/GoBlog
Remove useless mutex
This commit is contained in:
parent
763188169f
commit
5268529b12
|
@ -11,17 +11,11 @@ var bufferPool = sync.Pool{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var poolMutex sync.Mutex
|
|
||||||
|
|
||||||
func Get() *bytes.Buffer {
|
func Get() *bytes.Buffer {
|
||||||
poolMutex.Lock()
|
|
||||||
defer poolMutex.Unlock()
|
|
||||||
return bufferPool.Get().(*bytes.Buffer)
|
return bufferPool.Get().(*bytes.Buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Put(bufs ...*bytes.Buffer) {
|
func Put(bufs ...*bytes.Buffer) {
|
||||||
poolMutex.Lock()
|
|
||||||
defer poolMutex.Unlock()
|
|
||||||
for _, buf := range bufs {
|
for _, buf := range bufs {
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
bufferPool.Put(buf)
|
bufferPool.Put(buf)
|
||||||
|
|
Loading…
Reference in New Issue