[mythtv] Re: [mythtv-commits] mythtv commit: r7209 by danielk

Tom Hughes tom at compton.nu
Thu Sep 8 16:26:02 UTC 2005


In message <20050908162208.GG7406 at squashedfrog.net>
          Stuart Auchterlonie <stuarta at squashedfrog.net> wrote:

> Looks like there is a small problem with the way you have
> set the timeout for the select loop.
> 
> struct timeval select_timeout = { 0, (timeout_ms) % 1000 };
> 
> The second component of the timeout is measured in usecs,
> so when you are passing in 5000 you get a 5usec timeout.

That' a mod operator, so it's actually a zero second timeout...

> No quite what you had in mind. This is probably more like it.
> 
> struct timeval select_timeout = { 0, (timeout_ms) * 1000 };

Except that values over a second should go in the first element
so something like this:

  struct timeval select_timeout = { timeout_ms / 1000,
                                   (timeout_ms % 1000) * 1000 };

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/


More information about the mythtv-dev mailing list