zephyr/kernel
Robert Lubos e9cdcc235f kernel: timeout: Fix macro usage in next_timeout function
The `next_timeout()` function used to call the `elapsed()` function
directly in the `MAX` macro call. This caused the `elapsed()` function
to be executed twice, with possible different results, if the system
clock incremented its value in a meantime.

As a result, the whole `MAX(0, to->dticks - elapsed()` expresion could
return an incorrect value of -1, which represents the K_FOREVER timeout.
This led to a stall in devices running tickless kernel (as observed on
nRF52840).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-08-01 12:28:44 +02:00
..
include kernel: consolidate error handling code 2019-07-25 15:06:58 -07:00
atomic_c.c cleanup: include/: move atomic.h to sys/atomic.h 2019-06-27 22:55:49 -04:00
CMakeLists.txt kernel: consolidate error handling code 2019-07-25 15:06:58 -07:00
compiler_stack_protect.c kernel: consolidate error handling code 2019-07-25 15:06:58 -07:00
device.c cleanup: include/: move misc/util.h to sys/util.h 2019-06-27 22:55:49 -04:00
errno.c all: Update reserved function names 2019-03-11 13:48:42 -04:00
fatal.c sanitycheck: simplify fault detection 2019-07-25 15:06:58 -07:00
futex.c kernel: delete k_futex_init() 2019-07-01 08:15:10 -07:00
idle.c cleanup: include/: move power.h to power/power.h 2019-06-27 22:55:49 -04:00
init.c linker: Add dtcm section for Cortex M7 MCUs 2019-07-19 10:05:46 +02:00
Kconfig kernel: Crank up default tick rate 2019-07-02 22:52:29 -04:00
Kconfig.power_mgmt power: modify HAS_STATE_SLEEP_ Kconfig options 2019-03-26 13:27:55 -04:00
mailbox.c cleanup: include/: move misc/dlist.h to sys/dlist.h 2019-06-27 22:55:49 -04:00
mem_domain.c cleanup: include/: move misc/__assert.h to sys/__assert.h 2019-06-27 22:55:49 -04:00
mem_slab.c cleanup: include/: move misc/dlist.h to sys/dlist.h 2019-06-27 22:55:49 -04:00
mempool.c malloc: make sure returned memory is properly aligned 2019-07-03 14:17:29 -07:00
msg_q.c kernel: msgq: avoid single char variables for msgq 2019-07-04 10:04:27 -04:00
mutex.c cleanup: include/: move misc/dlist.h to sys/dlist.h 2019-06-27 22:55:49 -04:00
pipes.c cleanup: include/: move misc/dlist.h to sys/dlist.h 2019-06-27 22:55:49 -04:00
poll.c cleanup: include/: move misc/util.h to sys/util.h 2019-06-27 22:55:49 -04:00
queue.c cleanup: include/: move misc/sflist.h to sys/sflist.h 2019-06-27 22:55:49 -04:00
sched.c kernel: timeout: do not active time slicing if idle thread ready 2019-07-24 14:02:23 -07:00
sem.c cleanup: include/: move misc/dlist.h to sys/dlist.h 2019-06-27 22:55:49 -04:00
smp.c kernel/smp: Rename smp_init() 2019-06-05 17:15:55 -04:00
stack.c cleanup: include/: move misc/__assert.h to sys/__assert.h 2019-06-27 22:55:49 -04:00
system_work_q.c kernel: system_work_q: Set dedicated "sysworkq" name. 2018-10-19 07:58:45 -04:00
thread.c kernel: consolidate error handling code 2019-07-25 15:06:58 -07:00
thread_abort.c cleanup: include/: move misc/__assert.h to sys/__assert.h 2019-06-27 22:55:49 -04:00
timeout.c kernel: timeout: Fix macro usage in next_timeout function 2019-08-01 12:28:44 +02:00
timer.c linker generated list: provide an iterator to simplify list access 2019-06-06 14:21:32 -07:00
userspace.c cleanup: include/: move misc/rb.h to sys/rb.h 2019-06-27 22:55:49 -04:00
userspace_handler.c all: Update reserved function names 2019-03-11 13:48:42 -04:00
version.c doc: add kernel version API to doxygen 2018-12-08 17:24:53 -05:00
work_q.c kernel: Fix usage of CONFIG_SYS_CLOCK_EXISTS 2019-05-15 10:44:59 +02:00