Skip to content

Commit

Permalink
Prevent endless loop in run_scheduled_functions (esp8266#4048)
Browse files Browse the repository at this point in the history
  • Loading branch information
hreintke authored and devyte committed Dec 31, 2017
1 parent b2e2d22 commit f9c60a2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cores/esp8266/Schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
sLast = 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);
Expand Down

0 comments on commit f9c60a2

Please sign in to comment.