core/thread: add thread_getname() dummy available without DEVELHELP

This commit is contained in:
Kaspar Schleiser 2017-10-20 23:10:20 +02:00
parent dcc0804e10
commit e6a9a760a7
2 changed files with 8 additions and 3 deletions

View File

@ -447,10 +447,11 @@ char *thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_sta
*/ */
void thread_add_to_list(list_node_t *list, thread_t *thread); void thread_add_to_list(list_node_t *list, thread_t *thread);
#ifdef DEVELHELP
/** /**
* @brief Returns the name of a process * @brief Returns the name of a process
* *
* @note when compiling without DEVELHELP, this *always* returns NULL!
*
* @param[in] pid the PID of the thread to get the name from * @param[in] pid the PID of the thread to get the name from
* *
* @return the threads name * @return the threads name
@ -458,6 +459,7 @@ void thread_add_to_list(list_node_t *list, thread_t *thread);
*/ */
const char *thread_getname(kernel_pid_t pid); const char *thread_getname(kernel_pid_t pid);
#ifdef DEVELHELP
/** /**
* @brief Measures the stack usage of a stack * @brief Measures the stack usage of a stack
* *

View File

@ -44,13 +44,16 @@ int thread_getstatus(kernel_pid_t pid)
return t ? (int) t->status : STATUS_NOT_FOUND; return t ? (int) t->status : STATUS_NOT_FOUND;
} }
#ifdef DEVELHELP
const char *thread_getname(kernel_pid_t pid) const char *thread_getname(kernel_pid_t pid)
{ {
#ifdef DEVELHELP
volatile thread_t *t = thread_get(pid); volatile thread_t *t = thread_get(pid);
return t ? t->name : NULL; return t ? t->name : NULL;
} #else
(void)pid;
return NULL;
#endif #endif
}
void thread_sleep(void) void thread_sleep(void)
{ {