8000 Non-recurring scheduled functions may yield, therefore run_scheduled_… · dok-net/arduino-esp8266@249ed8a · GitHub
[go: up one dir, main page]

Skip to content

Commit 249ed8a

Browse files
committed
Non-recurring scheduled functions may yield, therefore run_scheduled_functions can use
optimistic_yield()
1 parent 140a6a9 commit 249ed8a

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

cores/esp8266/Schedule.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ bool schedule_recurrent_function_us(const std::function<bool(void)>& fn,
135135

136136
void run_scheduled_functions()
137137
{
138-
esp8266::polledTimeout::periodicFastMs yieldNow(100); // yield every 100ms
139-
140138
// prevent scheduling of new functions during this run
141139
auto stop = sLast;
142140
bool done = false;
@@ -161,14 +159,10 @@ void run_scheduled_functions()
161159
recycle_fn_unsafe(to_recycle);
162160
}
163161

164-
if (yieldNow)
165-
{
166-
// because scheduled functions might last too long for watchdog etc,
167-
// this is yield() in cont stack, but need to call cont_suspend directly
168-
// to prevent recursion into run_scheduled_recurrent_functions()
169-
esp_schedule();
170-
cont_suspend(g_pcont);
171-
}
162+
// scheduled functions might last too long for watchdog etc.
163+
// yield() is allowed in scheduled functions, therefore
164+
// recursion into run_scheduled_recurrent_functions() is permitted
165+
optimistic_yield(100000);
172166
}
173167
}
174168

0 commit comments

Comments
 (0)
0