Skip to content

Prevent endless loop in run_scheduled_functions#4048

Merged
devyte merged 3 commits intoesp8266:masterfrom
hreintke:ScheduleFunctionUpdate
Dec 31, 2017
Merged

Prevent endless loop in run_scheduled_functions#4048
devyte merged 3 commits intoesp8266:masterfrom
hreintke:ScheduleFunctionUpdate

Conversation

@hreintke
Copy link
Contributor

When scheduling the same function from within a scheduled function the "run_scheduled_function" does not finish -> loop is not being called anymore.

Example function is :

void CommandExecutor::getStreamChars(Stream* reqStream)
{
	if (reqStream->available())
	{
		executorReceive(reqStream->read());
	}
	schedule_function(std::bind(&CommandExecutor::getStreamChars,this,reqStream));
}

I am using this in order to have all the code within my classes and not dependent on (addtional) calls from within the loop fucntion,

This patch starts a a new chain of scheduled functions when starting current cycle

@devyte devyte merged commit f9c60a2 into esp8266:master Dec 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants