Home |
RTTarget-32 Programming Manual Function RTSetTlsSlots Function RTSetDLLNameTranslation System Management BIOS (SMBIOS) Advanced Programmable Interrupt Controller (APIC) |
Function RTSetTlsSlotsFunction RTSetTlsSlots changes the number of available TLS slots: DWORD RTSetTlsSlots(DWORD Slots, LPVOID * MainTlsArray); ParametersSlotsNew number of available TLS slots. This value must be in the range 16 .. 256. MainTlsArrayTLS data array to use for the main thread of the application. This array must have at least Slots entries. return valueNumber of allocated TLS slots after the call. This function must be called before any threads have been created as the allocated TLS arrays of existing threads (except the main thread) are not reallocated. The default number of available TLS slots (the number of unique indices which can be allocated via Win32 API function TlsAlloc) is 16. Index 0 is reserved for a pointer to the .EXE file's static TLS data segment (global thread variables). This function cannot be used to decrease the number of TLS slots. If Slots specifies a value less than the current limit, the function has no effect and the old limit is returned. Example:#include <windows.h> #include <rttarget.h> #define NEEDED_TLS_SLOTS 32 VOID MainTlsArray[NEEDED_TLS_SLOTS]; int main(void) { if (RTSetTlsSlots(NEEDED_TLS_SLOTS, MainTlsArray) < NEEDED_TLS_SLOTS) printf("failed to increase TLS slots!\n"); ... }
|