当前位置: 技术问答>linux和unix
求助线程的问题?
来源: 互联网 发布时间:2015-12-25
本文导语: nptl线程库中 为什么 kill 线程的tid(即gettid得到的那个) 整个进程会退出呢? 在父进程里,如何能感知子线程的状态呢? | In your process, you can set one main thread to watch the status of all...
nptl线程库中
为什么
kill 线程的tid(即gettid得到的那个)
整个进程会退出呢?
在父进程里,如何能感知子线程的状态呢?
为什么
kill 线程的tid(即gettid得到的那个)
整个进程会退出呢?
在父进程里,如何能感知子线程的状态呢?
|
In your process, you can set one main thread to watch the status of all other threads and handle the signal.
Then you set a signal handler of which the action is to kill some threads with some certain status.
Then in the SHELL, you can send signal to the process, and the threads can be killed.
it is not possible to directly kill the threads from shell, as far as i know.
Regards
Then you set a signal handler of which the action is to kill some threads with some certain status.
Then in the SHELL, you can send signal to the process, and the threads can be killed.
it is not possible to directly kill the threads from shell, as far as i know.
Regards
|
pthread_self() 可以获取到一个线程的ID,
void CThread::OnDelete()
{
int iResult;
if (m_bStart && pthread_self() != m_tThread) //end by another thread
{
iResult = pthread_cancel(m_tThread);
if (iResult)
std::cout
void CThread::OnDelete()
{
int iResult;
if (m_bStart && pthread_self() != m_tThread) //end by another thread
{
iResult = pthread_cancel(m_tThread);
if (iResult)
std::cout