mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 10:52:44 +01:00
core: thread_measure_stack_free() is only useful for DEVELHELP
This commit is contained in:
parent
9e3830a72b
commit
f7bdc7e4fe
@ -130,6 +130,7 @@ int thread_wakeup(kernel_pid_t pid);
|
||||
*/
|
||||
kernel_pid_t thread_getpid(void);
|
||||
|
||||
#ifdef DEVELHELP
|
||||
/**
|
||||
* @brief Measures the stack usage of a stack
|
||||
*
|
||||
@ -140,6 +141,7 @@ kernel_pid_t thread_getpid(void);
|
||||
* @return the amount of unused space of the thread's stack
|
||||
*/
|
||||
int thread_measure_stack_free(char *stack);
|
||||
#endif
|
||||
|
||||
/* @} */
|
||||
#endif /* __THREAD_H */
|
||||
|
@ -92,6 +92,7 @@ int thread_wakeup(kernel_pid_t pid)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEVELHELP
|
||||
int thread_measure_stack_free(char *stack)
|
||||
{
|
||||
unsigned int *stackp = (unsigned int *)stack;
|
||||
@ -105,6 +106,7 @@ int thread_measure_stack_free(char *stack)
|
||||
int space_free = (unsigned int)stackp - (unsigned int)stack;
|
||||
return space_free;
|
||||
}
|
||||
#endif
|
||||
|
||||
kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags, void *(*function)(void *arg), void *arg, const char *name)
|
||||
{
|
||||
@ -133,6 +135,7 @@ kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#ifdef DEVELHELP
|
||||
if (flags & CREATE_STACKTEST) {
|
||||
/* assign each int of the stack the value of it's address */
|
||||
unsigned int *stackmax = (unsigned int *)((char *)stack + stacksize);
|
||||
@ -147,6 +150,7 @@ kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags,
|
||||
/* create stack guard */
|
||||
*stack = (unsigned int)stack;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!inISR()) {
|
||||
dINT();
|
||||
|
Loading…
Reference in New Issue
Block a user