This is the mail archive of the ecos-discuss@sources.redhat.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]
Other format: [Raw text]

Re: Cyg_Thread::add_to_list()


Nick Garnett wrote:
> 
> 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
> configuration.
> 

I'm sure you have considered this, but why not just remove the thread
from the thread list in Cyg_Thread:exit()? You loose the ability
to debug threads in the exit state, but is that of any real concern?

Something else that I've been puzzled by is that the schedulers have
access to all threads, so couldn't there be a mechanism where by
the the gdb stubs query the scheduler for the list of threads?

-- 
Chris Morrow	YottaYotta Inc. email: cmorrow@yottayotta.com
phone: (780) 989 6814 web:	http:  //www.yottayotta.com

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


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