summaryrefslogtreecommitdiff
path: root/shared/runtime/softtimer.c
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2024-01-02 16:35:27 +1100
committerDamien George <damien@micropython.org>2024-05-31 16:44:09 +1000
commit83e82c5ad3fb9e8796d786e01509d264cfb205d3 (patch)
treeed4f8636eef2aaa77dded52f91c27149a5305f34 /shared/runtime/softtimer.c
parent74fb42aa82d537b6fefb463907274bd660c6ce8d (diff)
rp2: Refactor to not use pico-sdk alarm pool functions for sleeping.
The best_effort_wfe_or_timeout() and sleep_us() pico-sdk functions use the pico-sdk alarm pool internally, and that has a bug. Some usages inside pico-sdk (notably multicore_lockout_start_blocking()) will still end up calling best_effort_wfe_or_timeout(), although usually with "end_of_time" as the timeout value so it should avoid any alarm pool race conditions. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'shared/runtime/softtimer.c')
-rw-r--r--shared/runtime/softtimer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shared/runtime/softtimer.c b/shared/runtime/softtimer.c
index 13a6e7877..92a0d6d51 100644
--- a/shared/runtime/softtimer.c
+++ b/shared/runtime/softtimer.c
@@ -89,7 +89,7 @@ void soft_timer_handler(void) {
heap = (soft_timer_entry_t *)mp_pairheap_pop(soft_timer_lt, &heap->pairheap);
if (entry->flags & SOFT_TIMER_FLAG_PY_CALLBACK) {
mp_sched_schedule(entry->py_callback, MP_OBJ_FROM_PTR(entry));
- } else {
+ } else if (entry->c_callback) {
entry->c_callback(entry);
}
if (entry->mode == SOFT_TIMER_MODE_PERIODIC) {