MCPcopy Create free account
hub / github.com/FastLED/FastLED / setup

Function setup

src/platforms/win/run_unit_test.hpp:96–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96static void setup(double timeout_seconds = 20.0) FL_NOEXCEPT {
97 const char* disable_env = getenv("FASTLED_DISABLE_TIMEOUT_WATCHDOG");
98 if (disable_env && (strcmp(disable_env, "1") == 0 || strcmp(disable_env, "true") == 0)) {
99 return;
100 }
101
102 const char* timeout_env = getenv("FASTLED_TEST_TIMEOUT");
103 if (timeout_env) {
104 double parsed = atof(timeout_env);
105 if (parsed > 0.0) {
106 timeout_seconds = parsed;
107 }
108 }
109
110 g_timeout_seconds = timeout_seconds;
111 g_active = true;
112
113 // Create manual-reset event for cancellation signaling
114 g_cancel_event = CreateEventA(nullptr, TRUE, FALSE, nullptr);
115
116 DuplicateHandle( // nolint
117 GetCurrentProcess(), GetCurrentThread(),
118 GetCurrentProcess(), &g_main_thread,
119 0, FALSE, DUPLICATE_SAME_ACCESS
120 );
121
122 g_timer_thread = CreateThread(nullptr, 0, timer_thread_func, nullptr, 0, nullptr);
123 if (g_timer_thread != nullptr) {
124 printf("Runner watchdog enabled (%.1f seconds)\n", timeout_seconds);
125 }
126}
127
128static void cancel() FL_NOEXCEPT {
129 if (!g_active) {

Callers 3

mainFunction · 0.70
mainFunction · 0.70
fastled_setup_onceFunction · 0.50

Calls 3

getenvFunction · 0.85
strcmpFunction · 0.85
printfFunction · 0.85

Tested by

no test coverage detected