-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Changed memberproc to FUNCTOR in Learning the code-Threading page #4832
base: master
Are you sure you want to change the base?
Conversation
@peterbarker review please |
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.
Whoops - I guess this shows just how badly out-of-date documentation can get, and how much it can hurt when it does. Sorry to hear about your lost time :-/
I figure we just swipe a line of code from the current codebase that (presumably) works, which is my suggestion here.
@@ -42,10 +42,10 @@ hal.scheduler->register_timer_process() like this: | |||
|
|||
:: | |||
|
|||
hal.scheduler->register_timer_process(AP_HAL_MEMBERPROC(&AP_Baro_MS5611::_update)); | |||
hal.scheduler->register_timer_process(FUNCTOR(&AP_Baro_MS5611::_update)); |
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.
hal.scheduler->register_timer_process(FUNCTOR(&AP_Baro_MS5611::_update)); | |
hal.scheduler->register_timer_process(FUNCTOR_BIND_MEMBER(&AP_Camera_Backend::feedback_pin_timer, void)) |
|
||
that particular example is from the MS5611 barometer driver. The | ||
AP_HAL_MEMBERPROC() macro provides a way to encapsulate a C++ member | ||
FUNCTOR() macro provides a way to encapsulate a C++ member |
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.
FUNCTOR() macro provides a way to encapsulate a C++ member | |
FUNCTOR_BIND() macro provides a way to encapsulate a C++ member |
The example for registering a timer callback used a deprecated function called memberproc(). I spent multiple days trying to successfully register a callback before I realized that FUNCTOR is the new and updated way to wrap functions. This update will help streamline newcomers into development.
This addresses issue 1339
#1339