mirror of
https://github.com/apache/nuttx.git
synced 2026-09-25 01:07:40 +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:
@@ -71,6 +71,7 @@
|
||||
0, /* low_priority */ \
|
||||
0, /* max_repl */ \
|
||||
0, /* affinity */ \
|
||||
NULL, /* stackaddr */ \
|
||||
PTHREAD_STACK_DEFAULT, /* stacksize */ \
|
||||
{0, 0}, /* repl_period */ \
|
||||
{0, 0} /* budget */ \
|
||||
@@ -83,6 +84,7 @@
|
||||
PTHREAD_EXPLICIT_SCHED, /* inheritsched */ \
|
||||
0, /* low_priority */ \
|
||||
0, /* max_repl */ \
|
||||
NULL, /* stackaddr */ \
|
||||
PTHREAD_STACK_DEFAULT, /* stacksize */ \
|
||||
{0, 0}, /* repl_period */ \
|
||||
{0, 0}, /* budget */ \
|
||||
@@ -94,6 +96,7 @@
|
||||
PTHREAD_DEFAULT_POLICY, /* policy */ \
|
||||
PTHREAD_EXPLICIT_SCHED, /* inheritsched */ \
|
||||
0, /* affinity */ \
|
||||
NULL, /* stackaddr */ \
|
||||
PTHREAD_STACK_DEFAULT, /* stacksize */ \
|
||||
}
|
||||
#else
|
||||
@@ -102,6 +105,7 @@
|
||||
PTHREAD_DEFAULT_PRIORITY, /* priority */ \
|
||||
PTHREAD_DEFAULT_POLICY, /* policy */ \
|
||||
PTHREAD_EXPLICIT_SCHED, /* inheritsched */ \
|
||||
NULL, /* stackaddr */ \
|
||||
PTHREAD_STACK_DEFAULT, /* stacksize */ \
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -227,6 +227,7 @@ struct pthread_attr_s
|
||||
cpu_set_t affinity; /* Set of permitted CPUs for the thread */
|
||||
#endif
|
||||
|
||||
FAR void *stackaddr; /* Address of memory to be used as stack */
|
||||
size_t stacksize; /* Size of the stack allocated for the pthread */
|
||||
|
||||
#ifdef CONFIG_SCHED_SPORADIC
|
||||
@@ -406,6 +407,13 @@ int pthread_attr_getaffinity_np(FAR const pthread_attr_t *attr,
|
||||
int pthread_attr_setstacksize(FAR pthread_attr_t *attr, long stacksize);
|
||||
int pthread_attr_getstacksize(FAR const pthread_attr_t *attr, long *stackaddr);
|
||||
|
||||
/* Set or obtain stack address and size */
|
||||
|
||||
int pthread_attr_setstack(FAR pthread_attr_t *attr,
|
||||
FAR void *stackaddr, long stacksize);
|
||||
int pthread_attr_getstack(FAR pthread_attr_t *attr,
|
||||
FAR void **stackaddr, FAR long *stacksize);
|
||||
|
||||
/* To create a thread object and runnable thread, a routine must be specified
|
||||
* as the new thread's start routine. An argument may be passed to this
|
||||
* routine, as an untyped address; an untyped address may also be returned as
|
||||
|
||||
Reference in New Issue
Block a user