在 2023-06-07 22:47, Luca Bacci 写道:
Indeed it's quite a strange macro, reminds me of https://devblogs.microsoft.com/oldnewthing/20160613-00/?p=93655

The macro `TLS_MINIMUM_AVAILABLE` also does not make much sense because the indexes 0, 1, 4, 16 and 64 are pre-allocated and will be skipped by `TlsAlloc()`. The number of guaranteed TLS slots is a bit fewer than that.

Anyway, does the attached patch look good to you?


--
Best regards,
LIU Hao

From de676492b9e099956d12c3b2fea3b50c63dc30ae Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Wed, 7 Jun 2023 22:59:02 +0800
Subject: [PATCH] crt: Bump `FLS_MAXIMUM_AVAILABLE` since Windows 10 19H1

Reference: 
https://learn.microsoft.com/en-us/windows-insider/archive/new-in-19h1#fls-slot-limit-increase
Suggested-by: Luca Bacci <[email protected]>
Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/include/winnt.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mingw-w64-headers/include/winnt.h 
b/mingw-w64-headers/include/winnt.h
index 257efdc1b..354836968 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -4413,7 +4413,11 @@ typedef BYTE SE_SIGNING_LEVEL, *PSE_SIGNING_LEVEL;
       DWORD Flags;
     } JOB_SET_ARRAY,*PJOB_SET_ARRAY;
 
+#if NTDDI_VERSION >= NTDDI_WIN10_19H1
+#define FLS_MAXIMUM_AVAILABLE 4080
+#else
 #define FLS_MAXIMUM_AVAILABLE 128
+#endif
 #define TLS_MINIMUM_AVAILABLE 64
 
 #ifndef __MINGW_EXCPT_DEFINE_PSDK
-- 
2.41.0

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to