====== G ====== 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. Strictly related: - ''G'' (''struct G'') -- is an internal C struct containing some data related to a [[goroutine]] -- see: [[http://golang.org/src/pkg/runtime/runtime.h|pkg/runtime/runtime.h]] - ''g'' (''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. [[http://groups.google.com/group/golang-nuts/browse_thread/thread/3bdf4b609417939e/d4bf42f3fce610b0?#d4bf42f3fce610b0|(ref.)]] * NOTE: This variable [[https://code.google.com/p/go/source/diff?spec=svn9ef1fd2b7e476df9c04fec3c9833fe473cbacc42&name=9ef1fd2b7e47&r=9ef1fd2b7e476df9c04fec3c9833fe473cbacc42&format=side&path=/src/pkg/runtime/runtime.h#sc_svn9ef1fd2b7e476df9c04fec3c9833fe473cbacc42_94|is of special kind]] ''extern register'', and thus it [[http://doc.cat-v.org/plan_9/4th_edition/papers/compiler| must be declared in the same way in every C unit of compilation "in all modules and libraries"]]. This is guaranteed if you ''#include "runtime.h"''. ===== See also ===== * [[M]] * [[Thread-local storage]]