mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 10:46:28 +08:00
pthread: add pthread_attr_{get|set}guardsize support
This commit adds simple implementation of guardsize for pthreads. At this moment this option simply increases the size of allocated pthread stack. At default pthread guard size is set to 0. Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
committed by
Xiang Xiao
parent
46bbde02b1
commit
8108aad1a4
@@ -107,6 +107,7 @@
|
||||
|
||||
#define PTHREAD_STACK_MIN CONFIG_PTHREAD_STACK_MIN
|
||||
#define PTHREAD_STACK_DEFAULT CONFIG_PTHREAD_STACK_DEFAULT
|
||||
#define PTHREAD_GUARD_DEFAULT CONFIG_PTHREAD_GUARDSIZE_DEFAULT
|
||||
|
||||
/* Values for the pthread inheritsched attribute */
|
||||
|
||||
@@ -237,6 +238,7 @@ struct pthread_attr_s
|
||||
|
||||
FAR void *stackaddr; /* Address of memory to be used as stack */
|
||||
size_t stacksize; /* Size of the stack allocated for the pthread */
|
||||
size_t guardsize; /* Size of the guard area for the pthread's stack */
|
||||
|
||||
#ifdef CONFIG_SCHED_SPORADIC
|
||||
struct timespec repl_period; /* Replenishment period */
|
||||
@@ -529,6 +531,12 @@ int pthread_attr_getstack(FAR const pthread_attr_t *attr,
|
||||
int pthread_attr_setscope(FAR pthread_attr_t *attr, int scope);
|
||||
int pthread_attr_getscope(FAR const pthread_attr_t *attr, FAR int *scope);
|
||||
|
||||
/* Set/get guardsize attribute in thread attributes object */
|
||||
|
||||
int pthread_attr_setguardsize(FAR pthread_attr_t *attr, size_t guardsize);
|
||||
int pthread_attr_getguardsize(FAR const pthread_attr_t *attr,
|
||||
FAR size_t *guardsize);
|
||||
|
||||
/* Set or get the name of a thread */
|
||||
|
||||
int pthread_setname_np(pthread_t thread, FAR const char *name);
|
||||
|
||||
Reference in New Issue
Block a user