我有一个使用信号SIGCHLD的应用程序:
signal(SIGCHLD,ServiceApp_SignChild);
我发现此信号有时会导致程序死锁。为什么?
#0 __lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
#1 0x00007f2bff931c76 in __tz_convert (timer=0x7f2bffc3aac0 <tzset_lock>, use_localtime=1, tp=0x7f2bf835bea0) at tzset.c:616
#2 0x00007f2c01c0f599 in CNetEngine_OperatorTime::NetEngine_OperatorTime_GetSysTime (this=0x7f2c01e1114a <m_OperatorTimer>, pSt_LibTimer=0x7f2bf835bf50) at ./NetEngine_OperatorTime/NetEngine_OperatorTime.cpp:36
#3 0x00007f2c01c0fcea in NetEngine_OperatorTime_GetSysTime (pSt_LibTimer=0x7f2bf835bf50) at ./NetOperator_DllMain.cpp:68
#4 0x00007f2c0132d685 in CHelpComponents_XQLog::HelpComponents_XLog_Print (this=0x7f2c0152f0ec <m_XLog>, xhLog=0x14a4240, dwOutType=6, lpszFunction=0x42efc0 <ServiceApp_SignChild(int)::__FUNCTION__> "ServiceApp_SignChild", nLine=85, bIsLine=1, lpszLog=0x7f2bf835e830 "child exit,ID:21722") at ./HelpComponent_XLog/HelpComponent_XLog.cpp:137
#5 0x00007f2c0132dfea in HelpComponents_XLog_Print (xhLog=0x14a4240, dwOutType=6, lpszFunction=0x42efc0 <ServiceApp_SignChild(int)::__FUNCTION__> "ServiceApp_SignChild", nLine=85, bIsLine=1, lpszLog=0x42e448 "child exit,ID:%d") at ./XLog_DllMain.cpp:52
#6 0x00000000004213cc in ServiceApp_SignChild (signo=17) at ./SlCenter_Main.cpp:85
#7 <signal handler called>
#8 pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:183
#9 0x00007f2c017aa6e1 in tag_NetCore_ThreadPool::CManage_ThreadPoolWait::ThreadPool_WaitEvent (this=0x14a4be8) at ./ThreadPool/.././ThreadPool/ThreadPool.h:90
#10 0x00007f2c017aa362 in CManage_ThreadPool::ManagePool_Thread_Run (lParam=0x14a4ba0) at ./ThreadPool/ThreadPool.cpp:560
#11 0x00007f2bfffc76ba in start_thread (arg=0x7f2bf8362700) at pthread_create.c:333
#12 0x00007f2bff97b41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 2 (Thread 0x7f2bf8b63700 (LWP 29029)):
#0 __lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
#1 0x00007f2bff931c76 in __tz_convert (timer=0x7f2bffc3aac0 <tzset_lock>, use_localtime=1, tp=0x7f2bf8b5cea0) at tzset.c:616
#2 0x00007f2c01c0f599 in CNetEngine_OperatorTime::NetEngine_OperatorTime_GetSysTime (this=0x7f2c01e1114a <m_OperatorTimer>, pSt_LibTimer=0x7f2bf8b5cf50) at ./NetEngine_OperatorTime/NetEngine_OperatorTime.cpp:36
#3 0x00007f2c01c0fcea in NetEngine_OperatorTime_GetSysTime (pSt_LibTimer=0x7f2bf8b5cf50) at ./NetOperator_DllMain.cpp:68
#4 0x00007f2c0132d685 in CHelpComponents_XQLog::HelpComponents_XLog_Print (this=0x7f2c0152f0ec <m_XLog>, xhLog=0x14a4240, dwOutType=6, lpszFunction=0x42efc0 <ServiceApp_SignChild(int)::__FUNCTION__> "ServiceApp_SignChild", nLine=85, bIsLine=1, lpszLog=0x7f2bf8b5f830 ",child exit,IDID:21684") at ./HelpComponent_XLog/HelpComponent_XLog.cpp:137
#5 0x00007f2c0132dfea in HelpComponents_XLog_Print (xhLog=0x14a4240, dwOutType=6, lpszFunction=0x42efc0 <ServiceApp_SignChild(int)::__FUNCTION__> "ServiceApp_SignChild", nLine=85, bIsLine=1, lpszLog=0x42e448 "child exit,ID:%d") at ./XLog_DllMain.cpp:52
#6 0x00000000004213cc in ServiceApp_SignChild (signo=17) at ./SlCenter_Main.cpp:85
#7 <signal handler called>
#8 pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:183
#9 0x00007f2c017aa6e1 in tag_NetCore_ThreadPool::CManage_ThreadPoolWait::ThreadPool_WaitEvent (this=0x14a4968) at ./ThreadPool/.././ThreadPool/ThreadPool.h:90
#10 0x00007f2c017aa362 in CManage_ThreadPool::ManagePool_Thread_Run (lParam=0x14a4920) at ./ThreadPool/ThreadPool.cpp:560
#11 0x00007f2bfffc76ba in start_thread (arg=0x7f2bf8b63700) at pthread_create.c:333
#12 0x00007f2bff97b41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109