pthreads: Add support static pthread stack. Add standard pthread_attr_setstack() and pthread_attr_getstack(). In all cases where the stack is released, add check to see which allocator must be used to free the stack: The user or the kernel allocator.

This commit is contained in:
xuanlin
2018-08-23 09:48:53 -06:00
committed by Gregory Nutt
parent 86eef8ce3a
commit 2c93467436
19 changed files with 300 additions and 27 deletions
+8 -2
View File
@@ -94,14 +94,20 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (ttype == TCB_FLAG_TTYPE_KERNEL)
{
sched_kfree(dtcb->stack_alloc_ptr);
if (kmm_heapmember(dtcb->stack_alloc_ptr))
{
sched_kfree(dtcb->stack_alloc_ptr);
}
}
else
#endif
{
/* Use the user-space allocator if this is a task or pthread */
sched_ufree(dtcb->stack_alloc_ptr);
if (umm_heapmember(dtcb->stack_alloc_ptr))
{
sched_ufree(dtcb->stack_alloc_ptr);
}
}
/* Mark the stack freed */