Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function allocates a fiber object, assigns it a stack, and sets up execution to begin at the specified start address, typically the fiber function.

This function does not schedule the fiber.

Syntax

LPVOID WINAPI CreateFiber(
  DWORD 
dwStackSize,
  LPFIBER_START_ROUTINE 
lpStartAddress,
  LPVOID 
lpParameter
);

Parameters

dwStackSize

This argument is ignored in Windows Mobile. Fiber always uses the process stack size.

lpStartAddress

[in] Pointer to the application-defined function of type LPFIBER_START_ROUTINE to be executed by the fiber; represents the starting address of the fiber.

Execution of the new fiber does not begin until another fiber calls the SwitchToFiberfunction with this address.

lpParameter

[in] Specifies a single argument that is passed to the fiber.

This value can be retrieved by the fiber using the GetFiberDatamacro.

Return Value

The address of the fiber indicates success. NULL indicates failure. To get extended error information, call GetLastError.

Remarks

In Windows Mobile, dwStackSizemust be set to zero.

Before a thread can schedule a fiber using the SwitchToFiberfunction, it must call the ConvertThreadToFiberfunction so a fiber is associated with the thread.

A thread cannot be converted to a fiber if the stack size of the thread is different from the process default stack size set by the /STACK linker setting.

Requirements

Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also