Re: [PATCH] [gdb/tdep] Don't call WaitForSingleObject with INFINITE arg

Tom de Vries
2025-06-06T06:28:11Z

On 6/5/25 18:25, Pedro Alves wrote:
> On 2025-06-05 17:15, Pedro Alves wrote:
>> On 2025-06-05 16:03, Tom de Vries wrote:
>
>>> Fix this by avoiding calling WaitForSingleObject with INFINITE argument.
>>
>> Approved-By: Pedro Alves <pedro@palves.net>
>>
>
> Actually, can you add a comment to the code, please, explaining why we're avoiding INFINITE?
>
> LGTM with that. :-)
>

Hi Pedro,

thanks for the review.

I've added a comment, and pushed as v2 (
https://sourceware.org/pipermail/gdb-patches/2025-June/218402.html ).

Thanks,
- Tom

> On 2025-06-05 16:03, Tom de Vries wrote:
>> while (true)
>> {
>> - DWORD r = WaitForSingleObject (handle, howlong);
>> + DWORD milliseconds = howlong == INFINITE ? 100 : howlong;
>> + DWORD r = WaitForSingleObject (handle, milliseconds);
>> + if (howlong == INFINITE && r == WAIT_TIMEOUT)
>> + continue;
>> if (r == WAIT_OBJECT_0)
>> return;