[mythtv] Mythweather not download weather radar map.

Christian Hack christianh at pdd.edmi.com.au
Mon May 26 12:40:52 EDT 2003

> -----Original Message-----
> From: mythtv-dev-bounces at snowman.net
> [mailto:mythtv-dev-bounces at snowman.net]On Behalf Of Bruce Markey
> Sent: Sunday, 25 May 2003 5:26 AM
> To: Christian Hack; Development of mythtv
> Subject: Re: [mythtv] Mythweather not download weather radar map.
> Christian Hack wrote:
> > Thanks for the quick fix.
> >
> > While you're there John, I have another question I was going to ask but
> > forgot - although it maybe more due to the fact I don't completely
> > understand how all the comms works.
> >
> > In mythweathercomms.cpp you have the code chunk below. The way
> I read it you
> > do your timeouts by going to sleep for 50 _micro_ seconds at
> time. Thus if
> > your aggressiveness setting is even 15, the most it will wait
> is 15x50x5 us
> > = 3.75ms. i.e. not much of a timeout. I haven't bothered with
> the x10 and
> > x15 since I haven't looked at what getIntStatus is doing, but they won't
> > increase the timeout to very much.
> When a process sleeps, it relinquishes the CPU. After the
> timeout, the process becomes runable in the run queue and
> the process scheduler can run it in a future time slice. This
> is usually 10000-20000usec later. A small usleep says let
> something else run but check back with me as soon as possible.
> So even though it says 50 the average delay should be more
> like 15000usec.

Hmmm doesn't sound like good programming to me - I understand the concept
though. You are relying on using a call that doesn't give an accurate delay
to give an accurate delay. And even then 10-20000usecs still isn't enough to
give the correct times for timeouts. You need another order of magnitude
otherwise your max timeout is more like 1 second instead of 15 which clearly
isn't enough.

What happens when PCs/OSes get faster and usleep(50) really does only take
50usecs or approaches taking that long?

Basically it seems to take a lot less than 10000-20000 usecs on my machine.
The timeouts happen almost instantly. Once I change the usleep to 200000us
it works correctly and doesn't timeout...


More information about the mythtv-dev mailing list