0
1
mirror of https://github.com/golang/go synced 2025-05-07 03:41:34 +00:00

sync: convert RWMutex.{readerCount,readerWait} to atomic type

Change-Id: I7fd9c0636cd00891f5cdf36c0f68f897772042f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/429767
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
Cuong Manh Le
2022-09-09 20:53:13 +07:00
committed by Gopher Robot
parent 9dd9174fa5
commit e509452727
2 changed files with 24 additions and 24 deletions

@ -1,6 +1,7 @@
// +build !nacl,!386,!wasm,!arm,!gcflags_noopt
// errorcheck -0 -m
//go:build !nacl && !386 && !wasm && !arm && !gcflags_noopt
// Copyright 2019 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.
@ -35,19 +36,18 @@ func small6() { // ERROR "can inline small6"
var once *sync.Once
func small7() { // ERROR "can inline small7"
// the Do fast path should be inlined
once.Do(small5) // ERROR "inlining call to sync\.\(\*Once\)\.Do"
// the Do fast path should be inlined
once.Do(small5) // ERROR "inlining call to sync\.\(\*Once\)\.Do"
}
var rwmutex *sync.RWMutex
func small8() { // ERROR "can inline small8"
// the RUnlock fast path should be inlined
rwmutex.RUnlock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RUnlock"
func small8() {
// the RUnlock fast path should be inlined
rwmutex.RUnlock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RUnlock" "inlining call to atomic\.\(\*Int32\)\.Add"
}
func small9() { // ERROR "can inline small9"
// the RLock fast path should be inlined
rwmutex.RLock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RLock"
func small9() {
// the RLock fast path should be inlined
rwmutex.RLock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RLock" "inlining call to atomic\.\(\*Int32\)\.Add"
}