Skip to content

Commit

Permalink
Cygwin: SetThreadName: avoid spurious debug message
Browse files Browse the repository at this point in the history
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: d4689b9 ("Cygwin: Set threadnames with SetThreadDescription()")
Signed-off-by: Corinna Vinschen <[email protected]>
(cherry picked from commit 21a2c9d)
  • Loading branch information
github-cygwin committed Nov 20, 2024
1 parent 67b31bc commit 2196f93
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion winsup/cygwin/miscfuncs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2196f93

Please sign in to comment.