Letter “g” – is generally often used as a shorthand to a phrase “(current) goroutine” – see: http://groups.google.com/group/golang-nuts/browse_thread/thread/3bdf4b609417939e/8ddea965ec294ad6#8ddea965ec294ad6.
struct G) – is an internal C struct containing some data related to a goroutine – see: pkg/runtime/runtime.h
G g) – is a thread-local variable of type
struct G; “g is usually the current goroutine, but it's real purpose is to be the definitive place to find the current stack bounds during the stack growth check at the beginning of most functions. (ref.)
- NOTE: This variable is of special kind
extern register, and thus it must be declared in the same way in every C unit of compilation "in all modules and libraries". This is guaranteed if you
go/internals/g.txt · Last modified: 2020/11/23 17:23 by 127.0.0.1