FastLED 3.9.15
Loading...
Searching...
No Matches

◆ update_tasks_of_type()

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

Definition at line 156 of file async.cpp.

156 {
157 uint32_t current_time = fl::time();
158
159 // Use index-based iteration to avoid iterator invalidation issues
160 for (fl::size i = 0; i < mTasks.size();) {
161 task& t = mTasks[i];
162 auto impl = t.get_impl();
163
164 if (!impl || impl->is_canceled()) {
165 // erase() returns bool in HeapVector, not iterator
166 mTasks.erase(mTasks.begin() + i);
167 // Don't increment i since we just removed an element
168 } else if (impl->type() == task_type) {
169 // This is a frame task of the type we're looking for
170 bool should_run = impl->ready_to_run_frame_task(current_time);
171
172 if (should_run) {
173 // Update last run time for frame tasks (though they don't use it)
174 impl->set_last_run_time(current_time);
175
176 // Execute the task
177 if (impl->has_then()) {
178 impl->execute_then();
179 } else {
180 warn_no_then(impl->id(), impl->trace_label());
181 }
182
183 // Frame tasks are always one-shot, so remove them after execution
184 mTasks.erase(mTasks.begin() + i);
185 // Don't increment i since we just removed an element
186 } else {
187 ++i;
188 }
189 } else {
190 ++i; // Not the task type we're looking for
191 }
192 }
193}
fl::vector< task > mTasks
Definition async.h:256
void warn_no_then(int task_id, const fl::string &trace_label)
Definition async.cpp:195
static uint32_t t
Definition Luminova.h:54
fl::u32 time()
Universal millisecond timer - returns milliseconds since system startup.
Definition time.cpp:136

References mTasks, t, fl::time(), and warn_no_then().

Referenced by 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: