Home | History | Annotate | Download | only in signal

Lines Matching refs:Go

1 // Copyright 2015 The Go Authors. All rights reserved.
20 general, except as discussed below, Go programs will convert a
36 Default behavior of signals in Go programs
44 directly by the Go runtime to implement runtime.CPUProfile. Other
47 If the Go program is started with either SIGHUP or SIGINT ignored
50 If the Go program is started with a non-empty signal mask, that will
58 Changing the behavior of signals in Go programs
60 The functions in this package allow a program to change the way Go
93 When a Go program writes to a broken pipe, the kernel will raise a
112 Go programs that use cgo or SWIG
114 In a Go program that includes non-Go code, typically C/C++ code
115 accessed using cgo or SWIG, Go's startup code normally runs first. It
116 configures the signal handlers as expected by the Go runtime, before
117 the non-Go startup code runs. If the non-Go startup code wishes to
118 install its own signal handlers, it must take certain steps to keep Go
120 effect changes to signal handler settings by the non-Go code can have
121 on Go programs. In rare cases, the non-Go code may run before the Go
124 If the non-Go code called by the Go program does not change any signal
125 handlers or masks, then the behavior is the same as for a pure Go
128 If the non-Go code installs any signal handlers, it must use the
130 the program to crash if the signal is received. Go programs routinely
132 stack. Also, the Go standard library expects that any signal handlers
136 If the non-Go code installs a signal handler for any of the
138 the existing Go signal handler. If those signals occur while
139 executing Go code, it should invoke the Go signal handler (whether the
140 signal occurs while executing Go code can be determined by looking at
141 the PC passed to the signal handler). Otherwise some Go run-time
144 If the non-Go code installs a signal handler for any of the
145 asynchronous signals, it may invoke the Go signal handler or not as it
146 chooses. Naturally, if it does not invoke the Go signal handler, the
147 Go behavior described above will not occur. This can be an issue with
150 The non-Go code should not change the signal mask on any threads
151 created by the Go runtime. If the non-Go code starts new threads of
154 If the non-Go code starts a new thread, changes the signal mask, and
155 then invokes a Go function in that thread, the Go runtime will
158 SIGSETXID. When the Go function returns, the non-Go signal mask will
161 If the Go signal handler is invoked on a non-Go thread not running Go
162 code, the handler generally forwards the signal to the non-Go code, as
163 follows. If the signal is SIGPROF, the Go handler does
164 nothing. Otherwise, the Go handler removes itself, unblocks the
165 signal, and raises it again, to invoke any non-Go handler or default
166 system handler. If the program does not exit, the Go handler then
169 Non-Go programs that call Go code
171 When Go code is built with options like -buildmode=c-shared, it will
172 be run as part of an existing non-Go program. The non-Go code may
173 have already installed signal handlers when the Go code starts (that
175 the discussion here applies). For -buildmode=c-archive the Go runtime
177 -buildmode=c-shared the Go runtime will initialize signals when the
180 If the Go runtime sees an existing signal handler for the SIGCANCEL or
184 For the synchronous signals, the Go runtime will install a signal
186 signal arrives while executing non-Go code, the Go runtime will invoke
187 the existing signal handler instead of the Go signal handler.
189 Go code built with -buildmode=c-archive or -buildmode=c-shared will
191 existing signal handler, the Go runtime will turn on the SA_ONSTACK
193 asynchronous signal, a Go signal handler will be installed for that
195 handling for that signal will be reinstalled, restoring the non-Go
198 Go code built without -buildmode=c-archive or -buildmode=c-shared will
201 non-Go thread, it will act as described above, except that if there is
202 an existing non-Go signal handler, that handler will be installed