Skip to content

Commit e3897f0

Browse files
jonas-5ae29ckartben
authored andcommitted
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>
1 parent b8ed419 commit e3897f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ config NUM_PREEMPT_PRIORITIES
5353
int "Number of preemptible priorities" if MULTITHREADING
5454
default 0 if !MULTITHREADING
5555
default 15
56-
range 0 128
56+
range 0 127
5757
help
5858
Number of preemptible priorities available in the system. Gives access
5959
to priorities 0 to CONFIG_NUM_PREEMPT_PRIORITIES - 1.

0 commit comments

Comments
 (0)