Process and Thread Function ...


SwitchToFiber Function

Schedules a fiber. The function must be called on a fiber.

Syntax

C++
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 clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See Also

CreateFiber
ConvertThreadToFiber
Fibers
Process and Thread Functions

Send comments about this topic to Microsoft

Build date: 10/8/2009

Tags :


Page view tracker