Files
llgo/internal/lib/sync/pool.go

34 lines
778 B
Go
Raw Normal View History

2024-07-08 15:17:08 +08:00
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package sync
import "unsafe"
type Pool struct {
noCopy noCopy
local unsafe.Pointer // local fixed-size per-P pool, actual type is [P]poolLocal
localSize uintptr // size of the local array
victim unsafe.Pointer // local from previous cycle
victimSize uintptr // size of victims array
// New optionally specifies a function to generate
// a value when Get would otherwise return nil.
// It may not be changed concurrently with calls to Get.
New func() any
}
func (p *Pool) Put(x any) {
}
2024-07-29 16:31:59 +08:00
// TODO(xsw):
2024-07-08 15:17:08 +08:00
func (p *Pool) Get() any {
2024-07-29 16:31:59 +08:00
if p.New != nil {
return p.New()
}
return nil
2024-07-08 15:17:08 +08:00
}