-
Notifications
You must be signed in to change notification settings - Fork 3k
Improve FunctionPointer class #1783
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
Closed
Closed
Conversation
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
- Adopt C++11 style template arguments, requires rename to Callback - Add constructor for C style callback functions - Add constructor for Callbacks - Add static function for passing to C style callbacks
effectively: typedef Callback<R(A)> FunctionPointerArg1<R,A> typedef Callback<R()> FunctionPointerArg1<R,void> typedef Callback<R()> FunctionPointer typedef Callback<R()> event_callback_t
per @c1728p9 Update the Callback class to handle a NULL thunk by returning 0 rather than trying to call the thunk. This fixes a crash that occurs on some targets when the TX uart handler is not attached. Background: The K64F HAL uart implementation calls the TX interrupt handler every time a uart interrupt occurs while the TX register is empty. It does not check to see if the TX interrupt has been enabled. This means that the TX interrupt can and typically does get run on RX events. This causes a crash with the newer callback code which did not (prior to this patch) support a NULL thunk.
@mbed-bot: TEST HOST_OSES=ALL |
[Build 404] |
Looks like there might be a problem with this patch and the async api. |
0xc0170
added a commit
that referenced
this pull request
May 27, 2016
mv #1783(Improve FunctionPointer class) + minor compatibility fix
geky
added a commit
to geky/mbed
that referenced
this pull request
Jul 18, 2016
FunctionPointer/FunctionPointerArg0/FunctionPointerArg1 has been replaced by the more flexible Callback template class. For the motivation behind adopting the Callback class: ARMmbed#1783
deepakvenugopal
added a commit
to deepakvenugopal/mbed-os
that referenced
this pull request
Aug 22, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Here are the proposed changes for the FunctionPointer class:
cc @pan-, @sg-, @c1728p9
mv #94, #131, #139