Expand Minimize

SwitchToFiber function

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 XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

CreateFiber
ConvertThreadToFiber
Fibers
Process and Thread Functions

 

 

Community Additions

ADD
Show:
© 2014 Microsoft