mirror of https://github.com/python/cpython.git
gh-124609: Fix _Py_ThreadId for Windows builds using MinGW (#124663)
This commit is contained in:
parent
2e155536ca
commit
0881e2d3b1
|
@ -55,6 +55,10 @@
|
|||
# include <intrin.h> // __readgsqword()
|
||||
#endif
|
||||
|
||||
#if defined(Py_GIL_DISABLED) && defined(__MINGW32__)
|
||||
# include <intrin.h> // __readgsqword()
|
||||
#endif
|
||||
|
||||
// Include Python header files
|
||||
#include "pyport.h"
|
||||
#include "pymacro.h"
|
||||
|
|
|
@ -180,6 +180,12 @@ _Py_ThreadId(void)
|
|||
tid = __readfsdword(24);
|
||||
#elif defined(_MSC_VER) && defined(_M_ARM64)
|
||||
tid = __getReg(18);
|
||||
#elif defined(__MINGW32__) && defined(_M_X64)
|
||||
tid = __readgsqword(48);
|
||||
#elif defined(__MINGW32__) && defined(_M_IX86)
|
||||
tid = __readfsdword(24);
|
||||
#elif defined(__MINGW32__) && defined(_M_ARM64)
|
||||
tid = __getReg(18);
|
||||
#elif defined(__i386__)
|
||||
__asm__("movl %%gs:0, %0" : "=r" (tid)); // 32-bit always uses GS
|
||||
#elif defined(__MACH__) && defined(__x86_64__)
|
||||
|
|
|
@ -1552,6 +1552,7 @@ Lisa Roach
|
|||
Carl Robben
|
||||
Ben Roberts
|
||||
Mark Roberts
|
||||
Tony Roberts
|
||||
Andy Robinson
|
||||
Izan "TizzySaurus" Robinson
|
||||
Jim Robinson
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fix ``_Py_ThreadId`` for Windows builds using MinGW. Patch by Tony Roberts.
|
Loading…
Reference in New Issue