mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 18:47:47 +00:00
20 lines
373 B
Go
20 lines
373 B
Go
package sync
|
|
|
|
// Pool is a very simple implementation of sync.Pool. It does not actually
|
|
// implement a pool.
|
|
type Pool struct {
|
|
New func() interface{}
|
|
}
|
|
|
|
// Get returns the value of calling Pool.New().
|
|
func (p *Pool) Get() interface{} {
|
|
if p.New == nil {
|
|
return nil
|
|
}
|
|
return p.New()
|
|
}
|
|
|
|
// Put drops the value put into the pool.
|
|
func (p *Pool) Put(x interface{}) {
|
|
}
|