mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Prevent endless loop in run_scheduled_functions (#4048)
This commit is contained in:
parent
b2e2d2272f
commit
f9c60a226a
@ -65,12 +65,12 @@ bool schedule_function(std::function<void(void)> fn)
|
||||
|
||||
void run_scheduled_functions()
|
||||
{
|
||||
while (sFirst) {
|
||||
scheduled_fn_t* item = sFirst;
|
||||
sFirst = item->mNext;
|
||||
if (sFirst == NULL) {
|
||||
scheduled_fn_t* rFirst = sFirst;
|
||||
sFirst = NULL;
|
||||
sLast = NULL;
|
||||
}
|
||||
while (rFirst) {
|
||||
scheduled_fn_t* item = rFirst;
|
||||
rFirst = item->mNext;
|
||||
item->mFunc();
|
||||
item->mFunc = std::function<void(void)>();
|
||||
recycle_fn(item);
|
||||
|
Loading…
x
Reference in New Issue
Block a user