This is the mail archive of the 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]
Other format: [Raw text]

Re: Cyg_Thread::add_to_list()

Chris Morrow <> 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:
and search the list archive:

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