本文介绍了POSIX 线程和 SIGSEGV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 10 多个线程的系统.我有一个信号处理程序来捕获 SIGSEGV.如果一个线程生成 SIGSEGV,那么该信号会发送到所有线程,还是只发送到生成该信号的线程?

I have a system with 10+ threads. I have a signal handler to catch SIGSEGV. if one thread generates SIGSEGV, does that signal go to all threads, or just to the thread that generated the signal?

推荐答案

SIGSEGV 是一个同步信号.它将被传递给导致无效内存访问的线程.来自 signal(7):

SIGSEGV is a synchronous signal. It'll be delivered to the thread that caused the invalid memory access. From signal(7):

这篇关于POSIX 线程和 SIGSEGV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 23:35