aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2022-09-01 18:07:33 +0000
committerHeschi Kreinick <heschi@google.com>2022-09-01 18:08:05 +0000
commitef8414101fba959c8df220ca0e544781029ce111 (patch)
tree7d8250a0ae3a3c3f97a4f0162c900fa735605aea /src
parent5a6db7c48fb8a1e7b6d8f59ba4e3b7ecb8c35fc7 (diff)
downloadgo-ef8414101fba959c8df220ca0e544781029ce111.tar.xz
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>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/cgocall.go2
-rw-r--r--src/runtime/debug.go2
-rw-r--r--src/runtime/proc.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/cgocall.go b/src/runtime/cgocall.go
index 9d6568b292..0a25cb6562 100644
--- a/src/runtime/cgocall.go
+++ b/src/runtime/cgocall.go
@@ -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.
//
diff --git a/src/runtime/debug.go b/src/runtime/debug.go
index 531c316b97..669c36f0d5 100644
--- a/src/runtime/debug.go
+++ b/src/runtime/debug.go
@@ -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)
}
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 89cb5c70f0..6ecb786d1b 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -1530,7 +1530,7 @@ found:
}
unlock(&sched.lock)
- ncgocall.Add(int64(mp.ncgocall))
+ atomic.Xadd64(&ncgocall, int64(mp.ncgocall))
// Release the P.
handoffp(releasep())