Skip to content

Commit 149927a

Browse files
committed
py/scheduler: Add comment warning about C callbacks scheduling new tasks.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
1 parent 5008008 commit 149927a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

py/scheduler.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ static inline void mp_sched_run_pending(void) {
8888

8989
#if MICROPY_SCHEDULER_STATIC_NODES
9090
// Run all pending C callbacks.
91-
while (MP_STATE_VM(sched_head) != NULL) {
91+
// Warning: if C callbacks themserlves schedule new C callbacks this
92+
// loop will never exit.
93+
while (MP_STATE_VM(sched_head) != NULL && !pass_finished) {
9294
mp_sched_node_t *node = MP_STATE_VM(sched_head);
9395
MP_STATE_VM(sched_head) = node->next;
9496
if (MP_STATE_VM(sched_head) == NULL) {

0 commit comments

Comments
 (0)