]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: SetThreadName: avoid spurious debug message main master github/main github/master
authorCorinna Vinschen <corinna@vinschen.de>
Wed, 20 Nov 2024 15:21:03 +0000 (16:21 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Wed, 20 Nov 2024 15:31:26 +0000 (16:31 +0100)
The following debug message occassionally shows up in strace output:

  SetThreadName: SetThreadDescription() failed. 00000000 10000000

The HRESULT of 0x10000000 is not an error, rather the set bit just
indicates that this HRESULT has been created from an NTSTATUS value.

Use the IS_ERROR() macro instead of just checking for S_OK.

Fixes: d4689b99c686 ("Cygwin: Set threadnames with SetThreadDescription()")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/miscfuncs.cc

index 767384faa9aefcd09798eb8f37a15b942ab97b47..4220f6275785dcf9d84a35d97c626284dc0f36c5 100644 (file)
@@ -353,7 +353,7 @@ SetThreadName (DWORD dwThreadID, const char* threadName)
       WCHAR buf[bufsize];
       bufsize = MultiByteToWideChar (CP_UTF8, 0, threadName, -1, buf, bufsize);
       HRESULT hr = SetThreadDescription (hThread, buf);
-      if (hr != S_OK)
+      if (IS_ERROR (hr))
        {
          debug_printf ("SetThreadDescription() failed. %08x %08x\n",
                        GetLastError (), hr);
This page took 0.035681 seconds and 5 git commands to generate.