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: thread destructors


You haven't used a proper e-mail return address. This is highly antisocial. I will not make any further replies unless you use a real address.

Makarov wrote:
/*

Hello!

I use BDI2000, at91eb40, gcc 3.0.4, linux
I tried to use thread destructors, but with code below
 I've got infinite loop calling thread_destructor().
What is wrong with my code?
Don't call cyg_thread_delete() on the current thread! cyg_thread_delete() calls cyg_thread_kill() which (since this is the current thread) calls cyg_thread_exit(), which calls the destructor again, which calls....

Even outside a destructor, cyg_thread_delete() on the current thread is wrong as it will never run eCos's *internal* destructors for the thread because it will be removed from the scheduler before it has a chance to run them!

How to use destructors properly?
In which context are destructors called?
Aren't they called in context of exited thread??? :(
Yes.

Also for what you want make sure you've enabled CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD.

Jifl
--
eCosCentric http://www.eCosCentric.com/ <info@eCosCentric.com>
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine


--
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]