aboutsummaryrefslogtreecommitdiff
path: root/src/sync/poolqueue.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2021-12-01 12:15:45 -0500
committerRuss Cox <rsc@golang.org>2021-12-13 18:45:54 +0000
commit2580d0e08d5e9f979b943758d3c49877fb2324cb (patch)
tree3aafccfd81087734156a1778ce2321adf345f271 /src/sync/poolqueue.go
parent083ef5462494e81ee23316245c5d65085a3f62d9 (diff)
downloadgo-2580d0e08d5e9f979b943758d3c49877fb2324cb.tar.xz
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>
Diffstat (limited to 'src/sync/poolqueue.go')
-rw-r--r--src/sync/poolqueue.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/sync/poolqueue.go b/src/sync/poolqueue.go
index 9be83e9a43..631f2c15fd 100644
--- a/src/sync/poolqueue.go
+++ b/src/sync/poolqueue.go
@@ -77,7 +77,7 @@ func (d *poolDequeue) pack(head, tail uint32) uint64 {
// pushHead adds val at the head of the queue. It returns false if the
// queue is full. It must only be called by a single producer.
-func (d *poolDequeue) pushHead(val interface{}) bool {
+func (d *poolDequeue) pushHead(val any) bool {
ptrs := atomic.LoadUint64(&d.headTail)
head, tail := d.unpack(ptrs)
if (tail+uint32(len(d.vals)))&(1<<dequeueBits-1) == head {
@@ -98,7 +98,7 @@ func (d *poolDequeue) pushHead(val interface{}) bool {
if val == nil {
val = dequeueNil(nil)
}
- *(*interface{})(unsafe.Pointer(slot)) = val
+ *(*any)(unsafe.Pointer(slot)) = val
// Increment head. This passes ownership of slot to popTail
// and acts as a store barrier for writing the slot.
@@ -109,7 +109,7 @@ func (d *poolDequeue) pushHead(val interface{}) bool {
// popHead removes and returns the element at the head of the queue.
// It returns false if the queue is empty. It must only be called by a
// single producer.
-func (d *poolDequeue) popHead() (interface{}, bool) {
+func (d *poolDequeue) popHead() (any, bool) {
var slot *eface
for {
ptrs := atomic.LoadUint64(&d.headTail)
@@ -131,7 +131,7 @@ func (d *poolDequeue) popHead() (interface{}, bool) {
}
}
- val := *(*interface{})(unsafe.Pointer(slot))
+ val := *(*any)(unsafe.Pointer(slot))
if val == dequeueNil(nil) {
val = nil
}
@@ -144,7 +144,7 @@ func (d *poolDequeue) popHead() (interface{}, bool) {
// popTail removes and returns the element at the tail of the queue.
// It returns false if the queue is empty. It may be called by any
// number of consumers.
-func (d *poolDequeue) popTail() (interface{}, bool) {
+func (d *poolDequeue) popTail() (any, bool) {
var slot *eface
for {
ptrs := atomic.LoadUint64(&d.headTail)
@@ -166,7 +166,7 @@ func (d *poolDequeue) popTail() (interface{}, bool) {
}
// We now own slot.
- val := *(*interface{})(unsafe.Pointer(slot))
+ val := *(*any)(unsafe.Pointer(slot))
if val == dequeueNil(nil) {
val = nil
}
@@ -225,7 +225,7 @@ func loadPoolChainElt(pp **poolChainElt) *poolChainElt {
return (*poolChainElt)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(pp))))
}
-func (c *poolChain) pushHead(val interface{}) {
+func (c *poolChain) pushHead(val any) {
d := c.head
if d == nil {
// Initialize the chain.
@@ -255,7 +255,7 @@ func (c *poolChain) pushHead(val interface{}) {
d2.pushHead(val)
}
-func (c *poolChain) popHead() (interface{}, bool) {
+func (c *poolChain) popHead() (any, bool) {
d := c.head
for d != nil {
if val, ok := d.popHead(); ok {
@@ -268,7 +268,7 @@ func (c *poolChain) popHead() (interface{}, bool) {
return nil, false
}
-func (c *poolChain) popTail() (interface{}, bool) {
+func (c *poolChain) popTail() (any, bool) {
d := loadPoolChainElt(&c.tail)
if d == nil {
return nil, false