MCPcopy Create free account
hub / github.com/arkhipenko/TaskScheduler / priority_test_callback

Function priority_test_callback

tests/test-scheduler-priority.cpp:144–163  ·  view source on GitHub ↗

* @brief Priority test callback that uses currentScheduler() and currentTask() * * This callback mimics the example11 pattern by accessing the current scheduler * and task to get task ID and timing information. */

Source from the content-addressed store, hash-verified

142 * and task to get task ID and timing information.
143 */
144void priority_test_callback() {
145 priority_callback_counter++;
146
147 // Use currentScheduler() and currentTask() like in example11
148 Scheduler& current_scheduler = Scheduler::currentScheduler();
149 Task& current_task = current_scheduler.currentTask();
150
151 // Record task execution with ID for verification
152 unsigned int task_id = current_task.getId();
153 unsigned long execution_time = millis();
154
155 priority_execution_times[priority_execution_index++] = execution_time;
156
157 // Create output string with task ID for verification
158 std::string output = "task_" + std::to_string(task_id) + "_executed";
159 priority_test_output.push_back(output);
160
161 std::cout << "Task: " << task_id << " executed at " << execution_time
162 << "ms, Start delay = " << current_task.getStartDelay() << std::endl;
163}
164
165/**
166 * @brief Medium priority task callback - simulates intermediate priority work

Callers

nothing calls this directly

Calls 3

millisFunction · 0.85
getIdMethod · 0.80
getStartDelayMethod · 0.80

Tested by

no test coverage detected