github.com/PureWhiteWu/ppin@v0.0.0-20210222034823-197eac484787/ppin.go (about) 1 package ppin 2 3 import ( 4 _ "unsafe" 5 ) 6 7 //go:noescape 8 //go:linkname runtime_procPin runtime.procPin 9 func runtime_procPin() int 10 11 //go:noescape 12 //go:linkname runtime_procUnpin runtime.procUnpin 13 func runtime_procUnpin() 14 15 // Pin pins current p, return pid. 16 // DO NOT USE if you don't know what this is. 17 func Pin() int { 18 return runtime_procPin() 19 } 20 21 // Unpin unpins current p. 22 func Unpin() { 23 runtime_procUnpin() 24 }