loop() should have a "never timeout" option

Bug #1281548 reported by Ross Burton
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mosquitto
Won't Fix
Undecided
Unassigned

Bug Description

The loop() function has a timeout argument which is good, but there's no way of saying "don't timeout" which is bad for power efficiency. Many applications will be waiting entirely on MQTT messages arriving and whilst there are no messages the process could sit in select() forever, allowing the CPU to sleep. Without the ability to to say "don't timeout", the process is forced to wake up every <whatever> seconds and re-enter the loop.

Revision history for this message
Roger Light (roger.light) wrote : Re: [Bug 1281548] [NEW] loop() should have a "never timeout" option

Hi Ross,

In practice in the vast majority of cases you will have a finite
keepalive value set, at which point it is crucial to wake up at least
every keepalive seconds. It can also be important to drop out of the
loop to check on partially delivered messages if you're using a higher
qos, but that is less relevant than the first point.

Not exactly elegant, but you could also set the timeout value to e.g.
86400 if you wanted to ignore the above and only wake up once a day.

Cheers,

Roger

On Tue, Feb 18, 2014 at 11:49 AM, Ross Burton <email address hidden> wrote:
> Public bug reported:
>
> The loop() function has a timeout argument which is good, but there's no
> way of saying "don't timeout" which is bad for power efficiency. Many
> applications will be waiting entirely on MQTT messages arriving and
> whilst there are no messages the process could sit in select() forever,
> allowing the CPU to sleep. Without the ability to to say "don't
> timeout", the process is forced to wake up every <whatever> seconds and
> re-enter the loop.
>
> ** Affects: mosquitto
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because you are subscribed to
> mosquitto.
> https://bugs.launchpad.net/bugs/1281548
>
> Title:
> loop() should have a "never timeout" option
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/mosquitto/+bug/1281548/+subscriptions

Changed in mosquitto:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.