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

Class ThreadSafeTest

tests/test-scheduler-thread-safe.cpp:67–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65// ============================================
66
67class ThreadSafeTest : public ::testing::Test {
68protected:
69 void SetUp() override {
70 test_output.clear();
71 task_execution_count = 0;
72 thread1_requests = 0;
73 thread2_requests = 0;
74 isr_requests = 0;
75 clearTaskRequestQueue();
76 isInISRContext = false;
77 }
78
79 void TearDown() override {
80 clearTaskRequestQueue();
81 }
82
83 // Helper: Run scheduler for specified duration
84 void runScheduler(Scheduler& ts, unsigned long duration_ms) {
85 unsigned long start = millis();
86 while (millis() - start < duration_ms) {
87 ts.execute();
88 delay(1);
89 }
90 }
91
92 // Helper: Wait for condition with timeout
93 template<typename Condition>
94 bool waitForCondition(Condition cond, unsigned long timeout_ms) {
95 unsigned long start = millis();
96 while (millis() - start < timeout_ms) {
97 if (cond()) return true;
98 delay(10);
99 }
100 return false;
101 }
102};
103
104// ============================================
105// Basic Queue Tests

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected