Browse Source

thread: Don't use SetThreadDescription on WinRT right now.

Can't LoadLibrary for it, but not sure if it's actually available there yet.
Ryan C. Gordon 8 years ago
parent
commit
d1eb2d190d
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/thread/windows/SDL_systhread.c

+ 4 - 2
src/thread/windows/SDL_systhread.c

@@ -171,11 +171,12 @@ void
 SDL_SYS_SetupThread(const char *name)
 SDL_SYS_SetupThread(const char *name)
 {
 {
     if (name != NULL) {
     if (name != NULL) {
-        static HMODULE kernel32 = 0;
+        #ifndef __WINRT__   /* !!! FIXME: There's no LoadLibrary() in WinRT; don't know if SetThreadDescription is available there at all at the moment. */
         static pfnSetThreadDescription pSetThreadDescription = NULL;
         static pfnSetThreadDescription pSetThreadDescription = NULL;
+        static HMODULE kernel32 = 0;
 
 
         if (!kernel32) {
         if (!kernel32) {
-            kernel32 = LoadLibrary(L"kernel32.dll");
+            kernel32 = LoadLibraryW(L"kernel32.dll");
             if (kernel32) {
             if (kernel32) {
                 pSetThreadDescription = (pfnSetThreadDescription) GetProcAddress(kernel32, "SetThreadDescription");
                 pSetThreadDescription = (pfnSetThreadDescription) GetProcAddress(kernel32, "SetThreadDescription");
             }
             }
@@ -188,6 +189,7 @@ SDL_SYS_SetupThread(const char *name)
                 SDL_free(strw);
                 SDL_free(strw);
             }
             }
         }
         }
+        #endif
 
 
         /* Presumably some version of Visual Studio will understand SetThreadDescription(),
         /* Presumably some version of Visual Studio will understand SetThreadDescription(),
            but we still need to deal with older OSes and debuggers. Set it with the arcane
            but we still need to deal with older OSes and debuggers. Set it with the arcane