kernel: thread: fix thread priority off-by-one error

Setting CONFIG_NUM_PREEMPT_PRIORITIES to 128 causes the idle thread to be
assigned priority 128, which exceeds the int8_t range. This results in the
idle thread being assigned the highest priority (-128) instead of the
lowest, causing threads to not wake up from k_sleep.

Restrict the range of CONFIG_NUM_PREEMPT_PRIORITIES to 0 to 127 to ensure
the idle thread always has the lowest priority.

Signed-off-by: Jonas Spinner <jonas.spinner@burkert.com>
This commit is contained in:
Jonas Spinner 2025-02-07 09:26:17 +01:00 committed by Benjamin Cabé
commit e3897f0322

View file

@ -53,7 +53,7 @@ config NUM_PREEMPT_PRIORITIES
int "Number of preemptible priorities" if MULTITHREADING
default 0 if !MULTITHREADING
default 15
range 0 128
range 0 127
help
Number of preemptible priorities available in the system. Gives access
to priorities 0 to CONFIG_NUM_PREEMPT_PRIORITIES - 1.