mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 05:16:47 +08:00
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:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user