FastLED 3.10.8
Loading...
Searching...
No Matches

◆ update_tasks_of_type()

void fl::task::Scheduler::update_tasks_of_type ( TaskType task_type)
private

Definition at line 125 of file scheduler.cpp.hpp.

125 {
126 u32 current_time = fl::millis();
127
129
130 // Stable handles isolate dispatch from callbacks that mutate mTasks.
131 // Separate reusable buffers preserve before/after nesting without a heap
132 // allocation on every frame after each buffer reaches its high-water mark.
133 fl::vector<Handle>& snapshot = task_type == TaskType::kBeforeFrame
136 snapshot.clear();
137 for (const Handle& task : mTasks) {
138 if (task._type() == task_type &&
139 task._ready_to_run_frame_task(current_time)) {
140 snapshot.push_back(task);
141 }
142 }
143
144 const u32 clear_generation = mClearGeneration;
145 for (Handle& task : snapshot) {
146 if (mClearGeneration != clear_generation) {
147 break;
148 }
149 if (!task.is_valid() || task._is_canceled()) {
150 continue;
151 }
152
153 task._set_last_run_time(current_time);
154 if (task._has_then()) {
155 task._execute_then();
156 } else {
157 warn_no_then(task._id(), task._trace_label());
158 }
159 }
160 snapshot.clear();
163}
fl::vector< Handle > mTasks
Definition scheduler.h:46
void warn_no_then(int task_id, const fl::string &trace_label) FL_NO_EXCEPT
fl::vector< Handle > mAfterFrameSnapshot
Definition scheduler.h:48
void remove_inactive_tasks() FL_NO_EXCEPT
void update_frame_listener_registration() FL_NO_EXCEPT
fl::vector< Handle > mBeforeFrameSnapshot
Definition scheduler.h:47
void clear() FL_NO_EXCEPT
Definition vector.h:634
void push_back(const T &value) FL_NO_EXCEPT
Definition vector.h:624
@ kBeforeFrame
Runs immediately before each FastLED frame is rendered.
Definition task.h:120
fl::u32 millis() FL_NO_EXCEPT
Universal millisecond timer - returns milliseconds since system startup.

References fl::vector< T >::clear(), fl::FL_NO_EXCEPT, fl::task::kBeforeFrame, mAfterFrameSnapshot, mBeforeFrameSnapshot, mClearGeneration, fl::millis(), mTasks, fl::vector< T >::push_back(), remove_inactive_tasks(), update_frame_listener_registration(), and warn_no_then().

Referenced by fl::Singleton< Scheduler >, update_after_frame_tasks(), and update_before_frame_tasks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: