| |
@@ -0,0 +1,85 @@
|
| |
+ --- mingw-w64-libraries/winpthreads/src/misc.c.orig 2023-01-05 21:10:06.158696700 +0100
|
| |
+ +++ mingw-w64-libraries/winpthreads/src/misc.c 2023-01-05 21:14:13.736070700 +0100
|
| |
+ @@ -24,6 +24,16 @@
|
| |
+ #include "windows.h"
|
| |
+ #include "misc.h"
|
| |
+
|
| |
+ +static ULONGLONG (*GetTickCount64FuncPtr) (VOID);
|
| |
+ +
|
| |
+ +static void __attribute__((constructor)) ctor (void)
|
| |
+ +{
|
| |
+ + HMODULE module = LoadLibrary("kernel32.dll");
|
| |
+ + if (module == NULL) return;
|
| |
+ +
|
| |
+ + GetTickCount64FuncPtr = (__typeof__(GetTickCount64FuncPtr)) GetProcAddress(module, "GetTickCount64");
|
| |
+ +}
|
| |
+ +
|
| |
+ unsigned long long _pthread_time_in_ms(void)
|
| |
+ {
|
| |
+ FILETIME ft;
|
| |
+ @@ -55,10 +65,9 @@
|
| |
+ static unsigned long long
|
| |
+ _pthread_get_tick_count (long long *frequency)
|
| |
+ {
|
| |
+ -#if defined (_WIN32_WINNT) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
|
| |
+ - (void) frequency; /* unused */
|
| |
+ - return GetTickCount64 ();
|
| |
+ -#else
|
| |
+ + if (GetTickCount64FuncPtr != NULL)
|
| |
+ + return GetTickCount64FuncPtr ();
|
| |
+ +
|
| |
+ LARGE_INTEGER freq, timestamp;
|
| |
+
|
| |
+ if (*frequency == 0)
|
| |
+ @@ -74,7 +83,6 @@
|
| |
+
|
| |
+ /* Fallback */
|
| |
+ return GetTickCount ();
|
| |
+ -#endif
|
| |
+ }
|
| |
+
|
| |
+ /* A wrapper around WaitForSingleObject() that ensures that
|
| |
+ --- mingw-w64-libraries/winpthreads/src/thread.c.orig 2022-04-03 17:08:58.000000000 +0200
|
| |
+ +++ mingw-w64-libraries/winpthreads/src/thread.c 2023-01-05 18:47:08.847116100 +0100
|
| |
+ @@ -74,6 +74,19 @@
|
| |
+
|
| |
+ return EXCEPTION_CONTINUE_SEARCH;
|
| |
+ }
|
| |
+ +
|
| |
+ +static PVOID (*AddVectoredExceptionHandlerFuncPtr) (ULONG, PVECTORED_EXCEPTION_HANDLER);
|
| |
+ +static ULONG (*RemoveVectoredExceptionHandlerFuncPtr) (PVOID);
|
| |
+ +
|
| |
+ +static void __attribute__((constructor))
|
| |
+ +ctor (void)
|
| |
+ +{
|
| |
+ + HMODULE module = LoadLibrary("kernel32.dll");
|
| |
+ + if (module == NULL) return;
|
| |
+ +
|
| |
+ + AddVectoredExceptionHandlerFuncPtr = (__typeof__(AddVectoredExceptionHandlerFuncPtr)) GetProcAddress(module, "AddVectoredExceptionHandler");
|
| |
+ + RemoveVectoredExceptionHandlerFuncPtr = (__typeof__(RemoveVectoredExceptionHandlerFuncPtr)) GetProcAddress(module, "RemoveVectoredExceptionHandler");
|
| |
+ +}
|
| |
+ #endif
|
| |
+
|
| |
+ typedef struct _THREADNAME_INFO
|
| |
+ @@ -434,7 +447,8 @@
|
| |
+ #if defined(USE_VEH_FOR_MSC_SETTHREADNAME)
|
| |
+ if (lpreserved == NULL && SetThreadName_VEH_handle != NULL)
|
| |
+ {
|
| |
+ - RemoveVectoredExceptionHandler (SetThreadName_VEH_handle);
|
| |
+ + if (RemoveVectoredExceptionHandlerFuncPtr != NULL)
|
| |
+ + RemoveVectoredExceptionHandlerFuncPtr (SetThreadName_VEH_handle);
|
| |
+ SetThreadName_VEH_handle = NULL;
|
| |
+ }
|
| |
+ #endif
|
| |
+ @@ -443,7 +457,10 @@
|
| |
+ else if (dwReason == DLL_PROCESS_ATTACH)
|
| |
+ {
|
| |
+ #if defined(USE_VEH_FOR_MSC_SETTHREADNAME)
|
| |
+ - SetThreadName_VEH_handle = AddVectoredExceptionHandler (1, &SetThreadName_VEH);
|
| |
+ + if (AddVectoredExceptionHandlerFuncPtr != NULL)
|
| |
+ + SetThreadName_VEH_handle = AddVectoredExceptionHandlerFuncPtr (1, &SetThreadName_VEH);
|
| |
+ + else
|
| |
+ + SetThreadName_VEH_handle = NULL;
|
| |
+ /* Can't do anything on error anyway, check for NULL later */
|
| |
+ #endif
|
| |
+ }
|
| |
Will forward-port to rawhide if this is deemed acceptable (f39 because that's where I tested it for now).