Schedules a fiber. The function must be called on a fiber.
Syntax
VOID WINAPI SwitchToFiber(
__in LPVOID lpFiber
);
Parameters
- lpFiber [in]
-
The address of the fiber to be scheduled.
Return Value
This function does not return a value.
Remarks
You create fibers with the
CreateFiber function. 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.
Avoid making the following call:
SwitchToFiber( GetCurrentFiber() );
This call can cause unpredictable problems.
To compile an application that uses this function, define _WIN32_WINNT as 0x0400 or later. For more information, see
Using the Windows Headers.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | Winbase.h (include Windows.h) |
| Library | Kernel32.lib |
| DLL | Kernel32.dll |
See Also
- CreateFiber
- ConvertThreadToFiber
- Fibers
- Process and Thread Functions
Send comments about this topic to Microsoft
Build date: 11/19/2009