Skip to content

Commit

Permalink
py/scheduler: Use MP_REGISTER_ROOT_POINTER().
Browse files Browse the repository at this point in the history
This uses MP_REGISTER_ROOT_POINTER() to register sched_queue
instead of using a conditional inside of mp_state_vm_t.

Signed-off-by: David Lechner <david@pybricks.com>
  • Loading branch information
dlech authored and dpgeorge committed Jul 18, 2022
1 parent 85b4f36 commit a1ef5ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 0 additions & 4 deletions py/mpstate.h
Expand Up @@ -150,10 +150,6 @@ typedef struct _mp_state_vm_t {
// dictionary with loaded modules (may be exposed as sys.modules)
mp_obj_dict_t mp_loaded_modules_dict;

#if MICROPY_ENABLE_SCHEDULER
mp_sched_item_t sched_queue[MICROPY_SCHEDULER_DEPTH];
#endif

// dictionary for the __main__ module
mp_obj_dict_t dict_main;

Expand Down
2 changes: 2 additions & 0 deletions py/scheduler.c
Expand Up @@ -196,6 +196,8 @@ bool mp_sched_schedule_node(mp_sched_node_t *node, mp_sched_callback_t callback)
}
#endif

MP_REGISTER_ROOT_POINTER(mp_sched_item_t sched_queue[MICROPY_SCHEDULER_DEPTH]);

#endif // MICROPY_ENABLE_SCHEDULER

// Called periodically from the VM or from "waiting" code (e.g. sleep) to
Expand Down

0 comments on commit a1ef5ac

Please sign in to comment.