Expand Minimize

FlsAlloc function

Allocates a fiber local storage (FLS) index. Any fiber in the process can subsequently use this index to store and retrieve values that are local to the fiber.

Syntax


DWORD WINAPI FlsAlloc(
  _In_  PFLS_CALLBACK_FUNCTION lpCallback
);

Parameters

lpCallback [in]

A pointer to the application-defined callback function of type PFLS_CALLBACK_FUNCTION. This parameter is optional. For more information, see FlsCallback.

Return value

If the function succeeds, the return value is an FLS index initialized to zero.

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

Remarks

The fibers of the process can use the FLS index in subsequent calls to the FlsFree, FlsSetValue, or FlsGetValue functions.

FLS indexes are typically allocated during process or dynamic-link library (DLL) initialization. After an FLS index has been allocated, each fiber of the process can use it to access its own FLS storage slot. To store a value in its FLS slot, a fiber specifies the index in a call to FlsSetValue. The fiber specifies the same index in a subsequent call to FlsGetValue to retrieve the stored value.

FLS indexes are not valid across process boundaries. A DLL cannot assume that an index assigned in one process is valid in another process.

Requirements

Minimum supported client

Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2003 [desktop apps | Windows Store apps]

Header

WinBase.h on Windows Server 2003, Windows Vista, Windows 7, Windows Server 2008, and Windows Server 2008 R2 (include Windows.h);
Fibersapi.h on Windows 8 and Windows Server 2012

Library

Kernel32.lib

DLL

Kernel32.dll

See also

Fibers
FlsCallback
FlsFree
FlsGetValue
FlsSetValue
Process and Thread Functions

 

 

Community Additions

ADD
Show:
© 2014 Microsoft