mirror of https://github.com/golang/go.git
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:
parent
5a6db7c48f
commit
ef8414101f
|
|
@ -111,7 +111,7 @@ func syscall_cgocaller(fn unsafe.Pointer, args ...uintptr) uintptr {
|
||||||
return as.retval
|
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.
|
// Call from Go to C.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ func NumCPU() int {
|
||||||
|
|
||||||
// NumCgoCall returns the number of cgo calls made by the current process.
|
// NumCgoCall returns the number of cgo calls made by the current process.
|
||||||
func NumCgoCall() int64 {
|
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 {
|
for mp := (*m)(atomic.Loadp(unsafe.Pointer(&allm))); mp != nil; mp = mp.alllink {
|
||||||
n += int64(mp.ncgocall)
|
n += int64(mp.ncgocall)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1530,7 +1530,7 @@ found:
|
||||||
}
|
}
|
||||||
unlock(&sched.lock)
|
unlock(&sched.lock)
|
||||||
|
|
||||||
ncgocall.Add(int64(mp.ncgocall))
|
atomic.Xadd64(&ncgocall, int64(mp.ncgocall))
|
||||||
|
|
||||||
// Release the P.
|
// Release the P.
|
||||||
handoffp(releasep())
|
handoffp(releasep())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue