File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -71,9 +71,7 @@ void mp_handle_pending_tail(mp_uint_t atomic_state);
71
71
#if MICROPY_ENABLE_SCHEDULER
72
72
void mp_sched_lock (void );
73
73
void mp_sched_unlock (void );
74
- static inline unsigned int mp_sched_num_pending (void ) {
75
- return MP_STATE_VM (sched_len );
76
- }
74
+ #define mp_sched_num_pending () (MP_STATE_VM(sched_len))
77
75
bool mp_sched_schedule (mp_obj_t function , mp_obj_t arg );
78
76
#endif
79
77
Original file line number Diff line number Diff line change @@ -45,14 +45,14 @@ void MICROPY_WRAP_MP_KEYBOARD_INTERRUPT(mp_keyboard_interrupt)(void) {
45
45
46
46
#define IDX_MASK (i ) ((i) & (MICROPY_SCHEDULER_DEPTH - 1))
47
47
48
- static inline bool mp_sched_full (void ) {
48
+ // This is a macro so it is guaranteed to be inlined in functions like
49
+ // mp_sched_schedule that may be located in a special memory region.
50
+ #define mp_sched_full () (mp_sched_num_pending() == MICROPY_SCHEDULER_DEPTH)
51
+
52
+ static inline bool mp_sched_empty (void ) {
49
53
MP_STATIC_ASSERT (MICROPY_SCHEDULER_DEPTH <= 255 ); // MICROPY_SCHEDULER_DEPTH must fit in 8 bits
50
54
MP_STATIC_ASSERT ((IDX_MASK (MICROPY_SCHEDULER_DEPTH ) == 0 )); // MICROPY_SCHEDULER_DEPTH must be a power of 2
51
55
52
- return mp_sched_num_pending () == MICROPY_SCHEDULER_DEPTH ;
53
- }
54
-
55
- static inline bool mp_sched_empty (void ) {
56
56
return mp_sched_num_pending () == 0 ;
57
57
}
58
58
You can’t perform that action at this time.
0 commit comments