[PATCH] Cygwin: SetThreadName: avoid spurious debug message

Jon Turney jon.turney@dronecode.org.uk
Wed Nov 20 16:03:29 GMT 2024


On 20/11/2024 15:33, Corinna Vinschen wrote:
> On Nov 20 16:26, Corinna Vinschen wrote:
>> From: Corinna Vinschen <corinna@vinschen.de>
>>
>> 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.

Thanks.

Sorry for not writing this correctly in the first place.

>> Use the IS_ERROR() macro instead of just checking for S_OK.
>>
> 
> I missed this line:
> 
>    Fixes: d4689b99c686 ("Cygwin: Set threadnames with SetThreadDescription()")
> 
> Treat it as already added, please...
> 
>> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
>> ---
>>   winsup/cygwin/miscfuncs.cc | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
>> index 767384faa9ae..4220f6275785 100644
>> --- a/winsup/cygwin/miscfuncs.cc
>> +++ b/winsup/cygwin/miscfuncs.cc
>> @@ -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);
>> -- 
>> 2.47.0



More information about the Cygwin-patches mailing list