pthread_yield 与 p_thread_may 产量之间有什么区别。
答案 0 :(得分:1)
pthread_yield()
使调用线程立即放弃CPU。
然而,如果当前线程已经用完了给定的量子,pthread_may_yield()
将会产生。
pthread_may_yield ()
{
/* Whether this thread has used up its allocated time slice?
Set Variable to True if yes. */
if (thread has used up given quantum) {
pthread_yield();
}
}