-
Notifications
You must be signed in to change notification settings - Fork 3k
Add desctructor to PwmOut #2116
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
Conversation
@0xc0170 can you add needed reviewers in cc ? |
@@ -67,6 +67,10 @@ class PwmOut { | |||
core_util_critical_section_exit(); | |||
} | |||
|
|||
/** To Free up pwm pin. | |||
*/ | |||
virtual ~PwmOut(); |
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.
Why is dtor virtual
? I don't see any virtual method within this class, it's not intended to be a base class.
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.
Seconded.
Also the dtor can be inlined here, removing the need to add PwmOut.cpp
. Since the function is just a single call to the c api there is no benefit to declaring the function externally.
Looking at this file, should pwmout_free be in a critical section?
Sure - I inspired from other classes and thought it could be a base class as well ... I'll simplify and make it a change in header file only ... when I'm back |
Let us know once it's updated |
back now: I followed recommendations to move all changes to the header file and put it under critical section. This is now rebased on top of master |
@0xc0170 : update done |
@0xc0170 - seems there are no conflicts for now |
Thanks. We left similar comment to SerialBase dtor. This requires further design phase, how to handle destruction of objects that handles resources (peripherals). and what shall we allow/disallow within C++ drivers (copy constructor for instance). We will keep you updated. |
Is it really better to keep it like this ? |
For now, its better to leave it how it is since there are implication and documentation that also need to be considered. |
Please reopen when unblocked. |
well I'm not blocked, relevant issue is still open and valid afaik #3106 |
Issue #2017
Here's a proposal for review of ~PwmOut implementation