-
Notifications
You must be signed in to change notification settings - Fork 13.3k
add regular scheduled functions, now also callable on yield()
#6039
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
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
1674c72
add regular scheduled functions, now also callable on `yield()`
d-a-v 4f09a64
protect critical sections
d-a-v b6564c2
Merge branch 'master' into recurrentscheduledfunctions
d-a-v 545dd35
fix emulation on host, use alternate interruopt locking method
d-a-v aa4f87e
fix emulation on host
d-a-v 896b686
critical code protection (wip)
d-a-v fac39ed
add IRAM attrs where relevant
d-a-v 6e48831
add host emulation fake defines
d-a-v b9bf95b
fix per https://github.com/esp8266/Arduino/pull/6039#commitcomment-33…
d-a-v 37128a2
Merge branch 'master' into recurrentscheduledfunctions
earlephilhower 36ac7dd
wonderful idea with a class and its destructor for interrupt locking
d-a-v 499d2ea
remove duplicate interrupt lock class
d-a-v 19955d8
Merge commit '625c3a62c4991347e8298fb5e4021bc6f6df7099' into recurren…
d-a-v fc9ff2a
Merge branch 'master' into recurrentscheduledfunctions
d-a-v 97fde51
Merge branch 'master' into recurrentscheduledfunctions
d-a-v cce44be
Merge branch 'recurrentscheduledfunctions' of github.com:d-a-v/Arduin…
d-a-v 83ab383
remove ScheduledFunctions per https://github.com/esp8266/Arduino/pull…
d-a-v 8f1953e
Merge branch 'master' into recurrentscheduledfunctions
d-a-v d2e5fbc
Merge branch 'master' into recurrentscheduledfunctions
d-a-v 58cfb7b
Merge branch 'master' into recurrentscheduledfunctions
d-a-v c042640
restore FIFO
d-a-v 9854ad0
fix comments per review
d-a-v e42d104
Merge branch 'recurrentscheduledfunctions' of github.com:d-a-v/Arduin…
d-a-v c064a58
uodates per review
d-a-v 8f022c6
fixes per review
d-a-v e2ad457
fixes per review
d-a-v 16c7e62
fix inverted logic missed from review
d-a-v 7982a7f
fix per review https://github.com/d-a-v/Arduino/pull/6 (1/2)
d-a-v 65603a3
fix dangling pointer per https://github.com/d-a-v/Arduino/pull/6 last…
d-a-v 24474c8
pass lambdas with const refs
d-a-v d9c2270
Proposed changes from review
dok-net df839c2
Initial count not applied anymore
dok-net 40dbcc1
Merge pull request #6 from dok-net/d-a-v/recurrentscheduledfunctions
d-a-v 8e06c30
cosmetics
d-a-v a98cf9d
Merge branch 'master' into recurrentscheduledfunctions
earlephilhower File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Proposed changes from review
- Loading branch information
commit d9c227056e67fea00c6dff178c4791b7858ea324
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO: This linked-list implementation is not - probably never was - preemption safe, generally a compiler will keep the values of all the pointers in registers, even on the single-core ESP8266 an IRQ will not flush the registers but just push them to the stack and restore them, therefore any IRQ that's scheduling functions fails during an ongoing run_scheduled_functions(). Blocking IRQs during the complete execution of run_scheduled_functions makes it thread/IRQ safe, but I don't think this is permissible from an IRQ performance POV.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
We don't want to lock while executing the scheduled function themselvses.
One solution is to tag variables with
volatile
.Another one is to build a local copy of the list while being locked, then unlock and run that list.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I must step back on this.
Locking IRQ is the right thing to do when the value of a variable can be modified in a TAS block.
Even if there are registers holding some variables, they will not be changed while in a locked block because an IRQ won't occur in that block, regardless whether the variable is cached in a register.
I think the compiler will not / must not optimize a variable into registers when is it not declared locally.