This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


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

Re: Unix friendly Idle loop


>>>>> "Andrew" == Andrew Lunn <lunn@ma.tech.ascom.ch> writes:

>> Sounds like a good idea. Two (minor) problems that need attention
>> though:
>> 
>> In case CYGIMP_IDLE_THREAD_YIELD is defined, the idle thread loop
>> shouldn't hang (as the select would).

Andrew> But we want select to hang or we don't save anything. We need

I realize this :)

But what you want is the CPU to be free to do other host side stuff
when eCos would otherwise be idle.

When CYGIMP_IDLE_THREAD_YIELD is set it implies that the idle thread
would starve other eCos threads unless it calls yield()
repeatedly. I.e., in these (admitedly rare) configurations, your eCos
app might not behave as expected if you use the select(2) call. Some
threads may never be allowed to execute.

You are unlikely to be using such a configuration - but someone may
have to at some time. And eCos code must be safe to use with any
conceivable (valid) configuration.

In those configurations (i.e., when CYGIMP_IDLE_THREAD_YIELD is set) a
compromise might be to use nanosleep() with a suitable delay instead.


Hope my explanation makes more sense this time :)

Thanks,
Jesper

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