]> Cypherpunks.ru repositories - gostls13.git/commitdiff
Revert "runtime: convert ncgocall to atomic type"
authorMichael Pratt <mpratt@google.com>
Thu, 1 Sep 2022 18:07:33 +0000 (18:07 +0000)
committerHeschi Kreinick <heschi@google.com>
Thu, 1 Sep 2022 18:08:05 +0000 (18:08 +0000)
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>
src/runtime/cgocall.go
src/runtime/debug.go
src/runtime/proc.go

index 9d6568b2923678fad635440970e4d5aac4563703..0a25cb65629023eb76d3d7076d8b394cd2c81320 100644 (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.
 //
index 531c316b977ae5f6ea956411a05c4b80ea851be3..669c36f0d584bd7e2d464a893c6afc92f45c4cfa 100644 (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)
        }
index 89cb5c70f0967e6708509a7edceba88da9f5f3fd..6ecb786d1b053c12efe7a170dc6ff68550399ba0 100644 (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())