Source File
callbacks_unix.go
Belonging Package
runtime/cgo
// Copyright 2026 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.//go:build unixpackage cgoimport _ // for go:linkname// We need to reference the addresses of the C functions in Go code,// but we don't want to reference them directly in text. Otherwise it// may cause dynamic relocations in the text segment, or even build// failures in some settings, e.g. linking with -Bsymbolic-functions.// Reference them via variables with an extra level of indirection to// avoid that.//go:cgo_import_static x_cgo_init//go:linkname x_cgo_init x_cgo_init//go:linkname _cgo_init _cgo_initvar x_cgo_init bytevar _cgo_init = &x_cgo_init//go:cgo_import_static x_cgo_thread_start//go:linkname x_cgo_thread_start x_cgo_thread_start//go:linkname _cgo_thread_start _cgo_thread_startvar x_cgo_thread_start bytevar _cgo_thread_start = &x_cgo_thread_start// Creates a new system thread without updating any Go state.//// This method is invoked during shared library loading to create a new OS// thread to perform the runtime initialization. This method is similar to// x_cgo_thread_start except that it doesn't update any Go state.//go:cgo_import_static x_cgo_sys_thread_create//go:linkname x_cgo_sys_thread_create x_cgo_sys_thread_create//go:linkname _cgo_sys_thread_create _cgo_sys_thread_createvar x_cgo_sys_thread_create bytevar _cgo_sys_thread_create = &x_cgo_sys_thread_create// Store the g into the thread-specific value.// So that pthread_key_destructor will dropm when the thread is exiting.//go:cgo_import_static x_cgo_bindm//go:linkname x_cgo_bindm x_cgo_bindm//go:linkname _cgo_bindm _cgo_bindmvar x_cgo_bindm bytevar _cgo_bindm = &x_cgo_bindm// x_cgo_getstackbound gets the thread's C stack size and// set the G's stack bound based on the stack size.//go:cgo_import_static x_cgo_getstackbound//go:linkname x_cgo_getstackbound x_cgo_getstackbound//go:linkname _cgo_getstackbound _cgo_getstackboundvar x_cgo_getstackbound bytevar _cgo_getstackbound = &x_cgo_getstackbound
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |