Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent endless loop in run_scheduled_functions #4048

Merged
merged 3 commits into from
Dec 31, 2017
Merged

Prevent endless loop in run_scheduled_functions #4048

merged 3 commits into from
Dec 31, 2017

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