gpt4 book ai didi

c++ - SwitchTothread Windows 的 Linux 选项

转载 作者:可可西里 更新时间:2023-11-01 10:38:00 24 4
gpt4 key购买 nike

Windows 提供了一个函数 SwitchTothread,它提供了运行/调度低优先级线程的机会。有谁知道 Linux 中的选项? http://msdn.microsoft.com/en-us/library/windows/desktop/ms686352%28v=vs.85%29.aspx

最佳答案

那就是 pthread_yield() .

不同之处在于 SwitchToThread() 在线程切换发生时返回非零,否则返回零,而 pthread_yield() 在成功时返回零,在错误时返回非零(并且总是目前在 Linux 上成功)。

关于c++ - SwitchTothread Windows 的 Linux 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14344899/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com