FlsSetValue function (fibersapi.h)

Stores a value in the calling fiber's fiber local storage (FLS) slot for the specified FLS index. Each fiber has its own slot for each FLS index.


BOOL FlsSetValue(
  [in]           DWORD dwFlsIndex,
  [in, optional] PVOID lpFlsData


[in] dwFlsIndex

The FLS index that was allocated by the FlsAlloc function.

[in, optional] lpFlsData

The value to be stored in the FLS slot for the calling fiber.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError. The following errors can be returned.

Return code Description
The index is not in range.
The FLS array has not been allocated.


FLS indexes are typically allocated by the FlsAlloc function during process or DLL initialization. After an FLS index is allocated, each fiber of the process can use it to access its own FLS slot for that index. A thread specifies an FLS index in a call to FlsSetValue to store a value in its slot. The thread specifies the same index in a subsequent call to FlsGetValue to retrieve the stored value.


Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header fibersapi.h
Library Kernel32.lib
DLL Kernel32.dll

See also




Process and Thread Functions