Linux Option of SwitchTothread Windows

Linux Option of SwitchTothread Windows

本文关键字:Windows SwitchTothread of Option Linux      更新时间:2023-10-16

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

就是pthread_yield()。

区别在于,如果发生了线程切换,SwitchToThread()返回非零,否则返回零,而pthread_yield()在成功时返回零,在错误时返回非零(目前在Linux上总是成功)。