File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,15 +51,15 @@ struct Scheduler {
5151 if (microseconds == 0 ) [[unlikely]] microseconds = 1 ;
5252 return register_task (microseconds, func, false );
5353 }
54- static inline void cancel_timeout (uint8_t id) {
54+ static inline bool cancel_timeout (uint8_t id) {
5555 /* NOTE: This does not fix this case:
5656 1. id = set_timeout(x, func)
5757 2. timeout ends, func gets called and removed internally
5858 3. id_2 = set_timeout(y, func_2) // id will be equal to id_2
5959 4. clear_timeout(id) -> will remove the second timeout
6060 */
61- if (tasks_[id].repeating ) return ;
62- unregister_task (id);
61+ if (tasks_[id].repeating ) return false ;
62+ return unregister_task (id);
6363 }
6464
6565 // static void global_timer_callback();
Original file line number Diff line number Diff line change @@ -173,8 +173,6 @@ inline uint8_t Scheduler::allocate_slot() {
173173}
174174
175175inline void Scheduler::release_slot (uint8_t id) {
176- // NOTE: This condition shouldn't be here since it's an internal function but it could be an assert
177- if (id >= kMaxTasks ) [[unlikely]] return ;
178176 ready_bitmap_ &= ~(1u << id);
179177 free_bitmap_ |= (1u << id);
180178}
You can’t perform that action at this time.
0 commit comments