Version: v0.0.0-...-5253b6b Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 2 Imported by: 0



Package pool provides access to a mixer-global pool of buffers, a pool of goroutines, and a string interning table.



This section is empty.


This section is empty.


func GetBuffer

func GetBuffer() *bytes.Buffer

GetBuffer returns a buffer from the buffer pool.

func Intern

func Intern(s string) string

Intern returns a sharable version of the string, allowing the parameter's storage to be garbage collected.

func PutBuffer

func PutBuffer(b *bytes.Buffer)

PutBuffer returns a buffer to the buffer pool. You shouldn't reference this buffer after it has been returned to the pool, otherwise bad things will happen.


type GoroutinePool

type GoroutinePool struct {
	// contains filtered or unexported fields

GoroutinePool represents a set of reusable goroutines onto which work can be scheduled.

func NewGoroutinePool

func NewGoroutinePool(queueDepth int, singleThreaded bool) *GoroutinePool

NewGoroutinePool creates a new pool of goroutines to schedule async work.

func (*GoroutinePool) AddWorkers

func (gp *GoroutinePool) AddWorkers(numWorkers int)

AddWorkers introduces more goroutines in the worker pool, increasing potential parallelism.

func (*GoroutinePool) Close

func (gp *GoroutinePool) Close()

Close waits for all goroutines to terminate

func (*GoroutinePool) ScheduleWork

func (gp *GoroutinePool) ScheduleWork(fn WorkFunc)

ScheduleWork registers the given function to be executed at some point

type WorkFunc

type WorkFunc func()

WorkFunc represents a function to invoke from a worker.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL