[ECOS] thread_create stack base=NULL or size=0?

Nick Garnett nickg@ecoscentric.com
Wed Apr 15 16:08:00 GMT 2009

 Grant Edwards <grante@visi.com> writes:

> While looking into a DHCP management thread stack overflow
> problem, I've noticed comments in multiple places implying that
> when calling cyg_thread_create you can pass a NULL stack_base
> pointer to cyg_thread_create and/or a 0 stack_size.
> However, I can't find either of those possibilites mentioned in
> the documentation or in the code itself (though I don't really
> read C++).
> Can somebody explain the behavior of cyg_thread_create when the
> stack-base is NULL or when a stack-size is 0?

In the original design it was intended that there be an option to
allow the kernel to malloc all data structures, including thread
stacks (which may have had a default size, selected by zero). This is
why the object structure is passed in as the last argument, and we
return a "handle", which is just a copy of the structure address.

Ultimately we decided not to do that and make the user supply all
memory. However, the API features for this remained, and comments were
left in the code. 

Nick Garnett                                       eCos Kernel Architect
eCosCentric Limited    http://www.eCosCentric.com       The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.      Tel: +44 1223 245571
Registered in England and Wales:                         Reg No: 4422071

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

More information about the Ecos-discuss mailing list