线程连接中的 TERMINATED 消息
我在 UNIX 上的套接字编程中使用 pthreads。当父线程等待其子线程加入时,我在最后收到一条消息“终止”,这不是我从程序中打印出来的语句。
有人可以帮助我并告诉我这条消息的原因是什么吗?
当父线程等待连接并且子线程开始退出时会发生这种情况,但最终我收到此消息。
感谢大家
I am using pthreads on unix in socket programming. When the parent thread is waiting for it's child to join, I receive a message "Terminated" at the very end, this is not a statement that I am printing out from my program.
Could anybody help me and can tell what could be the reason for this message?
This happens when parent is waiting on join and child threads starts to exit, but eventually I am getting this message.
Thanks to all
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的 shell 会打印“已终止”消息,因为它注意到您的应用程序已被
SIGTERM
终止。这可能是由于您的代码中存在错误 - 我们需要查看源代码才能找到它。The "Terminated" message is printed by your shell since it noticed that your application was killed with a
SIGTERM
. This is likely due to a bug in your code - we'd need to see source in order to find it.Terminal
通常是程序收到SIGTERM
信号时的输出:在一个终端中启动:
从另一个终端:
我不完全确定为什么你的进程会收到一个
SIGTERM
,但我想知道您的孩子是否直接调用exit(2)
或exit(3)
,而不是调用pthread_exit( 3)
或从其功能的末端脱落。Terminated
is often the output when a program is sent theSIGTERM
signal:Start this in one terminal:
From another terminal:
I'm not entirely sure why your process is receiving a
SIGTERM
, but I wonder if your child is callingexit(2)
orexit(3)
directly, rather than callingpthread_exit(3)
or falling off the end of its function.