Platform SDK: DLLs, Processes, and Threads |
The SwitchToFiber function schedules a fiber. The caller of must be a fiber.
VOID SwitchToFiber( LPVOID lpFiber // fiber to schedule );
This function does not return a value.
You create fibers with CreateFiber. Before you can schedule fibers associated with a thread, you must call ConvertThreadToFiber to set up an area in which to save the fiber state information. The thread is now the currently executing fiber.
The SwitchToFiber function saves the state information of the current fiber and restores the state of the specified fiber. You can call SwitchToFiber with the address of a fiber created by a different thread. To do this, you must have the address returned to the other thread when it called CreateFiber and you must use proper synchronization.
Warning Avoid making the following call:
SwitchToFiber( GetCurrentFiber() );
This call may cause unpredictable problems.
Windows NT/2000: Requires Windows NT 3.51 SP3 or later.
Windows 95/98: Requires Windows 98.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
Processes and Threads Overview, Process and Thread Functions, CreateFiber, ConvertThreadToFiber