Skip to content

Wakeup delayed scheduling #6485

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

Merged
merged 15 commits into from
Oct 28, 2019
Merged

Conversation

dok-net
Copy link
Contributor

@dok-net dok-net commented Sep 4, 2019

I have a use case for the ESP8266 core schedule class that needs the capability to let recurrent, delayed functions run immediately on the next iteration of the scheduler without taking into account a remaining delay or repeat timeout.
This PR [originally added] an optional parameter const std::atomic<bool>* wakeupToken to schedule_recurrent_function_us(). This was changed, after review comments, into a std::function<bool(void)> alarm polling callback.
The remaining delay or the logic by which the scheduled function return value determines whether to keep scheduling for execution or to be removed from scheduling is unaltered by the alarm.

CoopTask release 2.0.0 depends on this PR for it's new Semaphore with milliseconds timeout.

@dok-net
Copy link
Contributor Author

dok-net commented Sep 4, 2019

Caveat: this PR implies and contains #6307 - both are unconditional requirements for using the core schedule class from CoopTasks.

@dok-net dok-net force-pushed the wakeup_delayed_scheduling branch from 5aacaa4 to e57cecc Compare September 7, 2019 06:14
@dok-net
Copy link
Contributor Author

dok-net commented Sep 11, 2019

This PR completely supersedes #6307 now - dropping #6307.

@dok-net dok-net force-pushed the wakeup_delayed_scheduling branch 3 times, most recently from afe402c to 9734760 Compare September 18, 2019 09:36
@dok-net dok-net force-pushed the wakeup_delayed_scheduling branch 2 times, most recently from be12074 to dc1219e Compare September 28, 2019 09:40
@dok-net dok-net force-pushed the wakeup_delayed_scheduling branch 3 times, most recently from b294bb1 to 2ad8442 Compare October 1, 2019 21:10
@dok-net dok-net force-pushed the wakeup_delayed_scheduling branch 3 times, most recently from 4cb7a7b to 69af810 Compare October 7, 2019 14:07
@devyte devyte requested a review from d-a-v October 7, 2019 21:53
@dok-net dok-net force-pushed the wakeup_delayed_scheduling branch 3 times, most recently from 5f959a9 to dbb1f48 Compare October 13, 2019 14:23
@devyte devyte added this to the 2.6.0 milestone Oct 15, 2019
@devyte devyte self-assigned this Oct 15, 2019
@dok-net dok-net force-pushed the wakeup_delayed_scheduling branch 2 times, most recently from 2a06c11 to ee9140d Compare October 18, 2019 16:18
@dok-net dok-net force-pushed the wakeup_delayed_scheduling branch from ee9140d to 861194e Compare October 27, 2019 16:31
@d-a-v
Copy link
Collaborator

d-a-v commented Oct 28, 2019

Out of curiosity, why is there a need for a FIFO when functions are called pseudo-asynchronously with potentially different timings ?

@dok-net dok-net force-pushed the wakeup_delayed_scheduling branch from dd3952a to e12a369 Compare October 28, 2019 09:04
@dok-net
Copy link
Contributor Author

dok-net commented Oct 28, 2019

I commented this in the commit 2 months ago:

Ordered, more predictable, scheduling. Before, it had different ordering compared to
[...] sequential calls from loop().

This affected test results with the use of CoopTasks (in this context, think of these as preemptable scheduled functions, stackful coroutines).

@devyte devyte merged commit 6e51ef0 into esp8266:master Oct 28, 2019
@dok-net dok-net deleted the wakeup_delayed_scheduling branch October 28, 2019 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants