作者littleboypis (littleboypis)
看板Programming
标题[问题] Pthread暂停和恢复功能
时间Sun Mar 8 16:43:23 2009
※ [本文转录自 C_and_CPP 看板]
作者: littleboypis (littleboypis) 看板: C_and_CPP
标题: [问题] Pthread暂停和恢复功能
时间: Sun Mar 8 16:43:08 2009
Pthread有暂停suspend和resume功能吗
因为我需要让Thread在执行到一半时暂停
像是
Work Thread Exec Body {
for( i = 1~100 ) {
call_action_1();
call_action_2();
call_action_3();
}
}
Another Thread {
pthread_suspend();
if( cond == true )
pthread_resume();
}
another thread执行了pthread_suspend
work thread就放下执行工作停下
可能停在任意的一行code上, 有可能是action1或者action3
不晓得Linux上的PThread有没有支援
我查google 和 API好像都没这两个功能
不晓得有什麽方式可以达到
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.123.216.117
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.123.216.117
1F:→ falis:使用semaphore如何 220.132.91.110 03/09 12:59