2012-04-29 115 views
1

我在C++中遇到了一个错误情况,我无法在pthread_join()中调用pthread_join()生成一些信号,但我不知道是哪一个信号,但是我的信号处理程序被调用,并且出于某种原因没有打印出正常调试生成的信号的信息。我没有得到一个堆栈跟踪显示:pthread_join()会导致什么信号?

# 2 /lib/tls/libpthread.so.0: pthread_join(...) +0x1c [0xce439c] 

我回顾了手册页在pthread_join(),并没有看到任何信号提。

什么可能是生成的信号,可能是什么原因?这可能是某种竞争条件。

+0

知道失败的原因在这里列出:http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_join.html 顺便说一句,什么是错误? – nullpotent 2012-04-29 01:12:05

+0

@Aljosha更好地使用更新的标准:http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_join.html - 行为现在未定义为无效参数,这意味着信号可能发生而不是错误返回。 – Potatoswatter 2012-04-29 01:57:32

+0

错误值未知。 – WilliamKF 2012-04-29 02:04:14

回答

2

http://linux.die.net/man/7/pthreads

Signals are used in implementation internally 

http://osr600doc.sco.com/man/html.PTHREAD/pthread_join.PTHREAD.html

The wait in pthread_join is not broken by a signal. 
If a thread waiting in pthread_join receives a signal that is not masked, 
it will execute the signal handler, and then return to waiting in pthread_join. 
Note that this behavior differs from that of pthread_cond_wait. 

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Fapis%2Fusers_25.htm

Threadsafe: Yes 
Signal Safe: No 

基本上,你可能会遇到在pthread_join()接受其他一些信号,由于一些事实错误或外部事件。

我们不能猜测究竟是什么原因导致的信号。

P.S.没有指定确切的环境,这使决策变得更加困难。

+0

这是一台Centos 4 32位机器。 – WilliamKF 2012-04-30 12:46:56

相关问题