[ECOS] Cyg_Thread::add_to_list()

Nick Garnett nickg@redhat.com
Mon Feb 18 02:25:00 GMT 2002

Chris Morrow <cmorrow@YottaYotta.com> writes:

> Why does add_to_list() search to see if the
> thread is already on the thread_list? Wouldn't
> that be a symptom of a bug?

Nope. We have the ability to restart a thread after it has called
Cyg_Thread:exit(). While a thread is in the exited state it is still
on the thread list. It only leaves the thread list if its destructor
is called.

We restart the thread by re-calling the constructor. Hence we need to
check whether the thread is a totally new one, or whether it is just
being restarted. If you never make use of the restart functionality,
then you can indeed get rid of this check. But there is no way for us
to know that at compile time.

The thread list is really only present for debugging purposes. It
supports the GDB "info threads" command and the kernel stack checking
code. If you don't use either of these, you can disable it in the

Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK

Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

More information about the Ecos-discuss mailing list