修复实现问题(仅针对linux平台):在sleep time为0时,原有实现直接sched_yield(),跟Sleep(0)本意不符,还是调整为直接调nanosleep(0),有关Sleep(0)的更多知识点:MSDN Sleep function
附 - Sleep(0)介绍(直接引用msdn文档):
[in] dwMilliseconds
The time interval for which execution is to be suspended, in milliseconds.
A value of zero causes the thread to relinquish the remainder of its time slice to any other thread that is ready to run. If there are no other threads ready to run, the function returns immediately, and the thread continues execution. Windows XP: A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. This behavior changed starting with Windows Server 2003.
A value of INFINITE indicates that the suspension should not time out.
LLBC_Yield()
:明确支持跨平台的Yield Processor支持LLBC_Sleep()
实现:#define LLBC_Sleep(milliSeconds) ::Sleep(milliSeconds)
,linux平台则调整为force inline
实现sched_yield()
,跟Sleep(0)
本意不符,还是调整为直接调nanosleep(0)
,有关Sleep(0)
的更多知识点:MSDN Sleep function附 - Sleep(0)介绍(直接引用msdn文档):
附 - Sleep(0) stack overflow: Significance of Sleep(0)