// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include /** * It should be possible to provide a generic implementation as long as a threadID is provided. We don't do that yet. */ struct FGenericPlatformTLS { static const uint32_t InvalidTlsSlot = 0xFFFFFFFF; /** * Return false if this is an invalid TLS slot * @param SlotIndex the TLS index to check * @return true if this looks like a valid slot */ static bool IsValidTlsSlot(uint32_t SlotIndex) { return SlotIndex != InvalidTlsSlot; } }; #if ZEN_PLATFORM_WINDOWS # include class FWindowsPlatformTLS : public FGenericPlatformTLS { public: static uint32_t AllocTlsSlot() { return ::TlsAlloc(); } static void FreeTlsSlot(uint32_t SlotIndex) { ::TlsFree(SlotIndex); } static void SetTlsValue(uint32_t SlotIndex, void* Value) { ::TlsSetValue(SlotIndex, Value); } /** * Reads the value stored at the specified TLS slot * * @return the value stored in the slot */ static void* GetTlsValue(uint32_t SlotIndex) { return ::TlsGetValue(SlotIndex); } /** * Return false if this is an invalid TLS slot * @param SlotIndex the TLS index to check * @return true if this looks like a valid slot */ static bool IsValidTlsSlot(uint32_t SlotIndex) { return SlotIndex != InvalidTlsSlot; } }; typedef FWindowsPlatformTLS FPlatformTLS; #elif ZEN_PLATFORM_MAC # include