[問題] 讓執行到一半的Thread停止
看板C_and_CPP (C/C++)作者littleboypis (littleboypis)時間16年前 (2009/02/14 13:45)推噓3(3推 0噓 8→)留言11則, 4人參與討論串1/2 (看更多)
請問一下
我要如何讓執行到一半的Thread停止呢
例如Thread正在執行
for( j = 0; j < 100; j++ )
{
printf( "j=%d\n", j );
}
另一個Thread呼叫了 killthread( thread_id )
那這一個功能是要怎麼去做呢
我不太曉得怎麼中止執行到一半的Thread
我有試過Pthread_kill, Pthread_cancel
可是Thread還是會從頭執行到尾
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.123.105.238
推
02/14 13:49, , 1F
02/14 13:49, 1F
→
02/14 13:50, , 2F
02/14 13:50, 2F
→
02/14 13:50, , 3F
02/14 13:50, 3F
→
02/14 13:59, , 4F
02/14 13:59, 4F
推
02/15 01:56, , 5F
02/15 01:56, 5F
→
02/15 01:57, , 6F
02/15 01:57, 6F
→
02/15 01:58, , 7F
02/15 01:58, 7F
→
02/15 01:58, , 8F
02/15 01:58, 8F
→
02/15 01:59, , 9F
02/15 01:59, 9F
→
02/15 02:00, , 10F
02/15 02:00, 10F
推
02/16 15:04, , 11F
02/16 15:04, 11F
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章