Cygwin: SetThreadName: avoid spurious debug message

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: d4689b99c6 ("Cygwin: Set threadnames with SetThreadDescription()")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2024-11-20 16:21:03 +01:00
parent 8dee07a1f1
commit 21a2c9db69
1 changed files with 1 additions and 1 deletions

View File

@ -353,7 +353,7 @@ SetThreadName (DWORD dwThreadID, const char* threadName)
WCHAR buf[bufsize]; WCHAR buf[bufsize];
bufsize = MultiByteToWideChar (CP_UTF8, 0, threadName, -1, buf, bufsize); bufsize = MultiByteToWideChar (CP_UTF8, 0, threadName, -1, buf, bufsize);
HRESULT hr = SetThreadDescription (hThread, buf); HRESULT hr = SetThreadDescription (hThread, buf);
if (hr != S_OK) if (IS_ERROR (hr))
{ {
debug_printf ("SetThreadDescription() failed. %08x %08x\n", debug_printf ("SetThreadDescription() failed. %08x %08x\n",
GetLastError (), hr); GetLastError (), hr);