Commit d2454936 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Delay lock in bufferpool.

parent 31a5c5c8
......@@ -100,14 +100,14 @@ func (me *BufferPool) AllocBuffer(size uint32) []byte {
// Takes back a buffer if it was allocated through AllocBuffer. It is
// not an error to call FreeBuffer() on a slice obtained elsewhere.
func (me *BufferPool) FreeBuffer(slice []byte) {
me.lock.Lock()
defer me.lock.Unlock()
if cap(slice) < PAGESIZE {
return
}
slice = slice[:cap(slice)]
key := uintptr(unsafe.Pointer(&slice[0]))
me.lock.Lock()
defer me.lock.Unlock()
exp, ok := me.outstandingBuffers[key]
if ok {
me.addBuffer(slice, exp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment