MCPcopy Create free account
hub / github.com/X-Profiler/xprofiler / SignalHandler

Function SignalHandler

src/platform/unix/core/linux/linuxthreads.cc:191–212  ·  view source on GitHub ↗

Signal handler to help us recover from dying while we are attached to * other threads. */

Source from the content-addressed store, hash-verified

189 * other threads.
190 */
191static void SignalHandler(int signum, siginfo_t* si, void* data) {
192 if (sig_pids != NULL) {
193 if (signum == SIGABRT) {
194 while (sig_num_threads-- > 0) {
195 /* Not sure if sched_yield is really necessary here, but it does not */
196 /* hurt, and it might be necessary for the same reasons that we have */
197 /* to do so in sys_ptrace_detach(). */
198 sys_sched_yield();
199 sys_ptrace(PTRACE_KILL, sig_pids[sig_num_threads], 0, 0);
200 }
201 } else if (sig_num_threads > 0) {
202 ResumeAllProcessThreads(sig_num_threads, (int*)sig_pids);
203 }
204 }
205 sig_pids = NULL;
206 if (sig_marker >= 0) NO_INTR(sys_close(sig_marker));
207 sig_marker = -1;
208 if (sig_proc >= 0) NO_INTR(sys_close(sig_proc));
209 sig_proc = -1;
210
211 sys__exit(signum == SIGABRT ? 1 : 2);
212}
213
214/* Try to dirty the stack, and hope that the compiler is not smart enough
215 * to optimize this function away. Or worse, the compiler could inline the

Callers

nothing calls this directly

Calls 1

ResumeAllProcessThreadsFunction · 0.70

Tested by

no test coverage detected