This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: assert: "no sleep slots"
- From: Gary Thomas <gary at mlbassoc dot com>
- To: Christoph Csebits <christoph dot csebits at frequentis dot com>
- Cc: ecos discuss list <ecos-discuss at sources dot redhat dot com>
- Date: Thu, 22 Jul 2004 06:04:04 -0600
- Subject: Re: [ECOS] assert: "no sleep slots"
- Organization: MLB Associates
- References: <20040722133544.A6565@frequentis.com>
On Thu, 2004-07-22 at 05:35, Christoph Csebits wrote:
> hi,
>
> in net/bsd_tcpip/current/src/ecos/synch.c
>
> there are the following code lines:
>
> CYG_ASSERT( i < CYGPKG_NET_NUM_WAKEUP_EVENTS, "no sleep slots" );
>
> // Defensive:
> if ( i >= CYGPKG_NET_NUM_WAKEUP_EVENTS ) {
> cyg_scheduler_unlock();
> return ETIMEDOUT;
> }
>
> The things on this:
>
> 1) The if clause is redundant, because the assert will stop execution anyway.
Only if you have asserts enabled!
> 2) I didn't try to figure out how this works, so my question:
> Is the assert there because, this must not happen (because of a
> bug/failure) or is it just here to say "no resources, please adjust
> your CDL parameters"?
>
> So, would it be possible to remove the assert and let the if clause
> return ETIMEDOUT instead?
This does just what it should - if you have asserts on, it will tell you
when you've run out of these resources which is arguably considered an
error. If you have no asserts, it at least tries to keep going.
We put the assert in there to trap this condition which we never expect
to see. In fact, to date it has never happened for anyone AFAIK, so it
is all merely defensive programming (as the comment states)
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss