Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
POSIX port - Switch from allowing the user to specify the stack, to a…
…llowing them to specify the stack size Change from pthread_attr_setstack() to pthread_attr_setstacksize(), and automatically adjust the stack size to be at least PTHREAD_STACK_MIN if it wasn't already, removing the size warning. This permits the user to increase the pthread stack size beyond the PTHREAD_STACK_MIN default of 16384 if desired, without producing a warning in the typical case where stacks are minimized for RAM limited targets. Continue to store thread paramters on the provided stack, for consistency with the MCU targets. Previously pthread_attr_setstack() was used to enable user defined stacks. Allowing user stacks has a few issues: 1. Stack sizes are limited to preserve available memory. Memory is not limited on systems running the POSIX port so there is no reason to attempt to limit the size of stack memory. 2. pxPortInitialiseStack() would print out warnings, and pthread_addr_setstack() would fail on stacks smaller than PTHREAD_STACK_MIN (16384) bytes. However PTHREAD_STACK_MIN may be larger than many task stacks so several warnings may be printed out. But, given #1 there is nothing really to worry about here. 3. Apparently it isn't possible to reuse stack memory once its been used in a pthread via pthread_attr_setstack(), see https://stackoverflow.com/a/5422134 Reuse of stack memory was also resulting in valgrind 'invalid write' errors to what was demonstrably valid memory. Root cause not determined.
- Loading branch information