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] |
Im my opinion there is no need to alter eCos behaviour. eCos does *not* need malloc/free so kernel should not use it. Threads' data can be allocated in global storage and/or on stacks and *nobody* should free that.
Obviously you can implement auto-free feature if you want. There is even no
need to modify existing eCos code!
One simple example (my first though):
1) create a special "free threads' storage" thread, give it the lowest possible priority (one higher the idle thread)
2) make this thread wait on mailbox, read from mailbox data mean memory addresses which are supposed to be freed, so free everything you receive.
3) make each dynamically allocated thread to put it's stack and/or thread data to this mailbox and issue thread->exit right after that.
You may need to modify it a little bit if you're using SMP system or if you cannot guarantee that the exiting thread would *not* hold for a while after putting data into mailbox but before final exit (normally threads' priorities should take care about it).
Thanks for help, Ivan.
-- 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] |