[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] stuck in consume_packets/multipoll loop
From: |
Eric S. Raymond |
Subject: |
Re: [gpsd-dev] stuck in consume_packets/multipoll loop |
Date: |
Wed, 20 Nov 2013 12:38:57 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Bernd Ocklin <address@hidden>:
> Hope this looks okay.
>
>
> diff --git a/libgpsd_core.c b/libgpsd_core.c
> index a8687df..68f36c1 100644
> --- a/libgpsd_core.c
> +++ b/libgpsd_core.c
> @@ -1548,6 +1548,18 @@ int gpsd_multipoll(const bool data_ready,
> /* handle data contained in this packet */
> if (device->packet.type != BAD_PACKET)
> /address@hidden@*/handler(device, changed);
> +
> +#ifdef __future__
> + /* Exit when a full packet was received and parsed.
> + * This allows other devices to be serviced even if
> + * this device delivers a full packet at every single
> + * read.
> + * Otherwise we can sit here for a long time without
> + * any for-loop exit condition being met.
> + */
> + if (changed & PACKET_SET)
> + break;
> +#endif // __future__
> }
> }
> else if (device->reawake>0 && timestamp()>device->reawake) {
>
>
> I think its better to exit the poll loop after each fully read and
> parsed package. Allowing to poll devices in a more fair round-robin
> fashion.
The patch is in good form. I question whether it is actually the
right place to do this thing, though. We'll consider it more
carefully after 3.10 has shipped.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>