]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: resolve latent function type TODO
authorTamir Duberstein <tamird@google.com>
Mon, 13 May 2019 15:26:26 +0000 (11:26 -0400)
committerAustin Clements <austin@google.com>
Mon, 13 May 2019 18:40:10 +0000 (18:40 +0000)
This was left over from the C->Go transition.

Change-Id: I52494af3d49a388dc45b57210ba68292ae01cf84
Reviewed-on: https://go-review.googlesource.com/c/go/+/176897
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/proc.go
src/runtime/runtime2.go

index 3897731164ca9bc9bc759383bf7321c61d0af89a..bf7835eb19848e3c3a39f872aa9038e19b933539 100644 (file)
@@ -295,7 +295,7 @@ func gopark(unlockf func(*g, unsafe.Pointer) bool, lock unsafe.Pointer, reason w
                throw("gopark: bad g status")
        }
        mp.waitlock = lock
-       mp.waitunlockf = *(*unsafe.Pointer)(unsafe.Pointer(&unlockf))
+       mp.waitunlockf = unlockf
        gp.waitreason = reason
        mp.waittraceev = traceEv
        mp.waittraceskip = traceskip
@@ -2595,8 +2595,7 @@ func park_m(gp *g) {
        casgstatus(gp, _Grunning, _Gwaiting)
        dropg()
 
-       if _g_.m.waitunlockf != nil {
-               fn := *(*func(*g, unsafe.Pointer) bool)(unsafe.Pointer(&_g_.m.waitunlockf))
+       if fn := _g_.m.waitunlockf; fn != nil {
                ok := fn(gp, _g_.m.waitlock)
                _g_.m.waitunlockf = nil
                _g_.m.waitlock = nil
index 51bec24de5c404bfad14a1c13c9eba043f7b7934..d2f9831f20d55cdabff7ec769ca355cbf2034cf9 100644 (file)
@@ -491,11 +491,11 @@ type m struct {
        schedlink     muintptr
        mcache        *mcache
        lockedg       guintptr
-       createstack   [32]uintptr    // stack that created this thread.
-       lockedExt     uint32         // tracking for external LockOSThread
-       lockedInt     uint32         // tracking for internal lockOSThread
-       nextwaitm     muintptr       // next m waiting for lock
-       waitunlockf   unsafe.Pointer // todo go func(*g, unsafe.pointer) bool
+       createstack   [32]uintptr // stack that created this thread.
+       lockedExt     uint32      // tracking for external LockOSThread
+       lockedInt     uint32      // tracking for internal lockOSThread
+       nextwaitm     muintptr    // next m waiting for lock
+       waitunlockf   func(*g, unsafe.Pointer) bool
        waitlock      unsafe.Pointer
        waittraceev   byte
        waittraceskip int