Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
 ConvertThreadToFiber Function

  Switch on low bandwidth view
ConvertThreadToFiber Function

Converts the current thread into a fiber. You must convert a thread into a fiber before you can schedule other fibers.

Syntax

C++
LPVOID WINAPI ConvertThreadToFiber(
  __in_opt  LPVOID lpParameter
);

Parameters

lpParameter [in, optional]

A pointer to a variable that is passed to the fiber. The fiber can retrieve this data by using the GetFiberData macro.

Return Value

If the function succeeds, the return value is the address of the fiber.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

Only fibers can execute other fibers. If a thread needs to execute a fiber, it must call ConvertThreadToFiber or ConvertThreadToFiberEx to create an area in which to save fiber state information. The thread is now the current fiber. The state information for this fiber includes the fiber data specified by lpParameter.

To compile an application that uses this function, define _WIN32_WINNT as 0x0400 or later. For more information, see Using the Windows Headers.

Examples

For an example, see Using Fibers.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See Also

ConvertFiberToThread
ConvertThreadToFiberEx
Fibers
GetFiberData
Process and Thread Functions

Send comments about this topic to Microsoft

Build date: 7/2/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker