8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a6bb79 commit af4a8e9Copy full SHA for af4a8e9
py/scheduler.c
@@ -88,11 +88,14 @@ static inline void mp_sched_run_pending(void) {
88
89
#if MICROPY_SCHEDULER_STATIC_NODES
90
// Run all pending C callbacks.
91
- while (MP_STATE_VM(sched_head) != NULL) {
+ bool pass_finished = false;
92
+ while (MP_STATE_VM(sched_head) != NULL && !pass_finished) {
93
mp_sched_node_t *node = MP_STATE_VM(sched_head);
94
MP_STATE_VM(sched_head) = node->next;
95
if (MP_STATE_VM(sched_head) == NULL) {
96
MP_STATE_VM(sched_tail) = NULL;
97
+ // ensure we exit even if a task re-scheduled in callback() below.
98
+ pass_finished = true;
99
}
100
mp_sched_callback_t callback = node->callback;
101
node->callback = NULL;
0 commit comments