Prev Next

SwitchToFiber info  Overview  Group

The SwitchToFiber function schedules a fiber.

VOID SwitchToFiber(

    LPVOID lpFiber

// pointer to fiber to switch to

   );

Parameters

lpFiber
Specifies the address of the fiber to switch to.

Return Values

This function does not return a value.

Remarks

The SwitchToFiber function is used to manually schedule a fiber. This function saves the state information of the current fiber and restores the state of the specified fiber. The caller of this routine must be a fiber.

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.

Warning  Avoid making the following call:

SwitchToFiber( GetCurrentFiber() );

 

This call causes unpredictable problems.

See Also

CreateFiber, ConvertThreadToFiber