2

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

4

1 回答 1

1

That would be pthread_yield().

The difference being that SwitchToThread() returns nonzero if a thread switch occurred and zero otherwise, whereas pthread_yield() returns zero on success and nonzero on error (and always succeeds on Linux for now).

于 2013-01-15T19:02:18.987 回答