1
0
mirror of https://github.com/golang/go synced 2024-11-06 09:16:16 -07:00
go/src/sync/export_test.go
Russ Cox 2580d0e08d all: gofmt -w -r 'interface{} -> any' src
And then revert the bootstrap cmd directories and certain testdata.
And adjust tests as needed.

Not reverting the changes in std that are bootstrapped,
because some of those changes would appear in API docs,
and we want to use any consistently.
Instead, rewrite 'any' to 'interface{}' in cmd/dist for those directories
when preparing the bootstrap copy.

A few files changed as a result of running gofmt -w
not because of interface{} -> any but because they
hadn't been updated for the new //go:build lines.

Fixes #49884.

Change-Id: Ie8045cba995f65bd79c694ec77a1b3d1fe01bb09
Reviewed-on: https://go-review.googlesource.com/c/go/+/368254
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-13 18:45:54 +00:00

58 lines
1.2 KiB
Go

// Copyright 2012 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
// Export for testing.
var Runtime_Semacquire = runtime_Semacquire
var Runtime_Semrelease = runtime_Semrelease
var Runtime_procPin = runtime_procPin
var Runtime_procUnpin = runtime_procUnpin
// poolDequeue testing.
type PoolDequeue interface {
PushHead(val any) bool
PopHead() (any, bool)
PopTail() (any, bool)
}
func NewPoolDequeue(n int) PoolDequeue {
d := &poolDequeue{
vals: make([]eface, n),
}
// For testing purposes, set the head and tail indexes close
// to wrapping around.
d.headTail = d.pack(1<<dequeueBits-500, 1<<dequeueBits-500)
return d
}
func (d *poolDequeue) PushHead(val any) bool {
return d.pushHead(val)
}
func (d *poolDequeue) PopHead() (any, bool) {
return d.popHead()
}
func (d *poolDequeue) PopTail() (any, bool) {
return d.popTail()
}
func NewPoolChain() PoolDequeue {
return new(poolChain)
}
func (c *poolChain) PushHead(val any) bool {
c.pushHead(val)
return true
}
func (c *poolChain) PopHead() (any, bool) {
return c.popHead()
}
func (c *poolChain) PopTail() (any, bool) {
return c.popTail()
}