github.com/liangmanlin/routine@v1.1.0/g/g.go (about)

     1  // Copyright 2022 TimAndy. All rights reserved.
     2  // Licensed under the Apache-2.0 license that can be found in the LICENSE file.
     3  
     4  package g
     5  
     6  import (
     7  	"reflect"
     8  	"unsafe"
     9  )
    10  
    11  // getgp returns the pointer to the current runtime.g.
    12  func getgp() unsafe.Pointer
    13  
    14  // getg0 returns the value of runtime.g0.
    15  func getg0() interface{}
    16  
    17  // getgt returns the type of runtime.g.
    18  //go:nosplit
    19  func getgt() reflect.Type {
    20  	return reflect.TypeOf(getg0())
    21  }