首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >pthread_yield与pthread_may_yield的差异?

pthread_yield与pthread_may_yield的差异?
EN

Stack Overflow用户
提问于 2016-01-28 06:52:24
回答 1查看 825关注 0票数 0

pthread_yieldp_thread_may产量的差异是什么?

EN

回答 1

Stack Overflow用户

发布于 2016-06-20 06:38:01

pthread_yield()使调用线程立即放弃CPU。

然而,如果当前线程用完了给定的量程,pthread_may_yield()就会产生结果。

代码语言:javascript
复制
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();
    }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35054624

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档