From 5c170c704640b8da31aca6a447f47fed27055d84 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 28 Mar 2024 07:20:51 -0400 Subject: [PATCH] kernel: thread: rename is_preempt Trivila rename to thread_is_preempt. Signed-off-by: Anas Nashif --- kernel/include/kthread.h | 4 ++-- kernel/sched.c | 2 +- kernel/thread.c | 2 +- kernel/timeslicing.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/include/kthread.h b/kernel/include/kthread.h index 3ec6cf8883..9fd5c9e4d9 100644 --- a/kernel/include/kthread.h +++ b/kernel/include/kthread.h @@ -49,7 +49,7 @@ static inline void thread_schedule_new(struct k_thread *thread, k_timeout_t dela } #endif /* CONFIG_MULTITHREADING */ -static inline int is_preempt(struct k_thread *thread) +static inline int thread_is_preemptible(struct k_thread *thread) { /* explanation in kernel_struct.h */ return thread->base.preempt <= _PREEMPT_THRESHOLD; @@ -209,7 +209,7 @@ static ALWAYS_INLINE bool should_preempt(struct k_thread *thread, /* Otherwise we have to be running a preemptible thread or * switching to a metairq */ - if (is_preempt(_current) || thread_is_metairq(thread)) { + if (thread_is_preemptible(_current) || thread_is_metairq(thread)) { return true; } diff --git a/kernel/sched.c b/kernel/sched.c index 5f38740c3e..2ea7531f58 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -334,7 +334,7 @@ static void update_metairq_preempt(struct k_thread *thread) #if (CONFIG_NUM_METAIRQ_PRIORITIES > 0) && \ (CONFIG_NUM_COOP_PRIORITIES > CONFIG_NUM_METAIRQ_PRIORITIES) if (thread_is_metairq(thread) && !thread_is_metairq(_current) && - !is_preempt(_current)) { + !thread_is_preemptible(_current)) { /* Record new preemption */ _current_cpu->metairq_preempted = _current; } else if (!thread_is_metairq(thread) && !z_is_idle_thread_object(thread)) { diff --git a/kernel/thread.c b/kernel/thread.c index 83f2ee2e72..23deffff42 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -110,7 +110,7 @@ static inline void *z_vrfy_k_thread_custom_data_get(void) int z_impl_k_is_preempt_thread(void) { - return !arch_is_in_isr() && is_preempt(_current); + return !arch_is_in_isr() && thread_is_preemptible(_current); } #ifdef CONFIG_USERSPACE diff --git a/kernel/timeslicing.c b/kernel/timeslicing.c index 3ed83e1ed8..401bcea0c7 100644 --- a/kernel/timeslicing.c +++ b/kernel/timeslicing.c @@ -38,7 +38,7 @@ static inline int slice_time(struct k_thread *thread) bool thread_is_sliceable(struct k_thread *thread) { - bool ret = is_preempt(thread) + bool ret = thread_is_preemptible(thread) && slice_time(thread) != 0 && !z_is_prio_higher(thread->base.prio, slice_max_prio) && !z_is_thread_prevented_from_running(thread)