This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR remote/21188: Fix remote serial timeout


On 17-02-20 05:52 PM, Gareth McMullin wrote:
> The timeout mechanism in ser-unix.c was changed in commit 048094acc.
> 
> In do_hardwire_readchar(), the required timeout is broken into 1
> second intervals and wait_for() is called.  Before, wait_for() set
> VTIME and VMIN so the read would block, but now it uses select() to
> block for the specified timeout.  If wait_for() returns
> SERIAL_TIMEOUT, do_hardwire_readchar() returns immediately, so the
> timeout is always only 1s.
> 
> The attached patch will repeatedly call wait_for() until the full
> timeout has elapsed.
> 
> Gareth
> 

I think I understand the problem you describe by inspecting the code.  However,
I have some difficulty understanding the current and proposed code, so I can't
say if the patch looks correct.  It just looks more complicated than necessary.

For example, what's the point of the timeout_remaining field in struct serial?  It
seems to ever only be used in this function.  If we can remove it, it will be one
less thing to consider.  We can probably have just the timeout variable that we
decrement until it's done.

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]