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()
|
void run_scheduled_functions()
|
||||||
{
|
{
|
||||||
while (sFirst) {
|
scheduled_fn_t* rFirst = sFirst;
|
||||||
scheduled_fn_t* item = sFirst;
|
sFirst = NULL;
|
||||||
sFirst = item->mNext;
|
sLast = NULL;
|
||||||
if (sFirst == NULL) {
|
while (rFirst) {
|
||||||
sLast = NULL;
|
scheduled_fn_t* item = rFirst;
|
||||||
}
|
rFirst = item->mNext;
|
||||||
item->mFunc();
|
item->mFunc();
|
||||||
item->mFunc = std::function<void(void)>();
|
item->mFunc = std::function<void(void)>();
|
||||||
recycle_fn(item);
|
recycle_fn(item);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user