windows.hThe SwitchToThread function causes the calling thread to yield execution to another thread that is ready to run on the current processor. The operating system selects the thread to yield to.If calling the SwitchToThread function causes the operating system to switch execution to another thread, the return value is nonzero. If there are no other threads ready to execute, the operating system does not switch execution to another thread, and the return value is zero.
摘自msdnSwitchToThreadThe SwitchToThread function causes the calling thread to yield execution to another thread that is ready to run on the current processor. The operating system selects the thread to yield to. BOOL SwitchToThread(void);Parameters This function has no parameters. Return Values If calling the SwitchToThread function causes the operating system to switch execution to another thread, the return value is nonzero.If there are no other threads ready to execute, the operating system does not switch execution to another thread, and the return value is zero.Res The yield of execution is in effect for up to one thread-scheduling time slice. After that, the operating system reschedules execution for the yielding thread. The rescheduling is determined by the priority of the yielding thread and the status of other threads that are available to run.Note The yield of execution is limited to the processor of the calling thread. The operating system will not switch execution to another processor, even if that processor is idle or is running a thread of lower priority.To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information, see Using the SDK Headers.Requirements Client: Included in Windows XP, Windows 2000 Professional, and Windows NT Workstation 4.0. Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server 4.0. Header: Declared in Winbase.h; include Windows.h. Library: Use Kernel32.lib.
you must define _WIN32_WINNT 0x0500 and this fuction is not supported by win98
BOOL SwitchToThread(void);Parameters
This function has no parameters.
Return Values
If calling the SwitchToThread function causes the operating system to switch execution to another thread, the return value is nonzero.If there are no other threads ready to execute, the operating system does not switch execution to another thread, and the return value is zero.Res
The yield of execution is in effect for up to one thread-scheduling time slice. After that, the operating system reschedules execution for the yielding thread. The rescheduling is determined by the priority of the yielding thread and the status of other threads that are available to run.Note The yield of execution is limited to the processor of the calling thread. The operating system will not switch execution to another processor, even if that processor is idle or is running a thread of lower priority.To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information, see Using the SDK Headers.Requirements
Client: Included in Windows XP, Windows 2000 Professional, and Windows NT Workstation 4.0.
Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server 4.0.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
and this fuction is not supported by win98