FlsAlloc function (fibersapi.h)
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.
DWORD FlsAlloc( [in] PFLS_CALLBACK_FUNCTION lpCallback );
A pointer to the application-defined callback function of type PFLS_CALLBACK_FUNCTION. This parameter is optional. For more information, see FlsCallback.
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.
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.
|Minimum supported client||Windows Vista [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2003 [desktop apps | UWP apps]|