From 315cdcdb5fed02b22ce668de812d6425dda3017f Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 5 Aug 2020 10:51:16 +0200 Subject: [PATCH] core/thread: Make thread_get inlineable --- core/include/thread.h | 8 +++++++- core/thread.c | 8 -------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/core/include/thread.h b/core/include/thread.h index e3dc3ef8dc..6a1e6cfb71 100644 --- a/core/include/thread.h +++ b/core/include/thread.h @@ -356,7 +356,13 @@ kernel_pid_t thread_create(char *stack, * @param[in] pid Thread to retrieve. * @return `NULL` if the PID is invalid or there is no such thread. */ -volatile thread_t *thread_get(kernel_pid_t pid); +static inline volatile thread_t *thread_get(kernel_pid_t pid) +{ + if (pid_is_valid(pid)) { + return sched_threads[pid]; + } + return NULL; +} /** * @brief Returns the status of a process diff --git a/core/thread.c b/core/thread.c index 48bd2debbd..0c5f61f96c 100644 --- a/core/thread.c +++ b/core/thread.c @@ -30,14 +30,6 @@ #include "bitarithm.h" #include "sched.h" -volatile thread_t *thread_get(kernel_pid_t pid) -{ - if (pid_is_valid(pid)) { - return sched_threads[pid]; - } - return NULL; -} - thread_status_t thread_getstatus(kernel_pid_t pid) { volatile thread_t *thread = thread_get(pid);