From 7a43f8a5fb355a9cff73314d234da9a817695cbd Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 13 May 2019 11:26:26 -0400 Subject: [PATCH] runtime: resolve latent function type TODO 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 TryBot-Result: Gobot Gobot Reviewed-by: Austin Clements --- src/runtime/proc.go | 5 ++--- src/runtime/runtime2.go | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 3897731164..bf7835eb19 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -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 diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 51bec24de5..d2f9831f20 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -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 -- 2.50.0