Revert "runtime: convert ncgocall to atomic type"

This reverts CL 426075.

Reason for revert: Import missing from cgocall.go.

Change-Id: Iac17e914045b83da30484dbe2a624cde526fb175
Reviewed-on: https://go-review.googlesource.com/c/go/+/427614
Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
Michael Pratt 2022-09-01 18:07:33 +00:00 committed by Heschi Kreinick
parent 5a6db7c48f
commit ef8414101f
3 changed files with 3 additions and 3 deletions

View File

@ -111,7 +111,7 @@ func syscall_cgocaller(fn unsafe.Pointer, args ...uintptr) uintptr {
return as.retval
}
var ncgocall atomic.Uint64 // number of cgo calls in total for dead m
var ncgocall uint64 // number of cgo calls in total for dead m
// Call from Go to C.
//

View File

@ -45,7 +45,7 @@ func NumCPU() int {
// NumCgoCall returns the number of cgo calls made by the current process.
func NumCgoCall() int64 {
var n = int64(ncgocall.Load())
var n = int64(atomic.Load64(&ncgocall))
for mp := (*m)(atomic.Loadp(unsafe.Pointer(&allm))); mp != nil; mp = mp.alllink {
n += int64(mp.ncgocall)
}

View File

@ -1530,7 +1530,7 @@ found:
}
unlock(&sched.lock)
ncgocall.Add(int64(mp.ncgocall))
atomic.Xadd64(&ncgocall, int64(mp.ncgocall))
// Release the P.
handoffp(releasep())