AP_Scheduler: unify singleton naming to _singleton and get_singleton()

This commit is contained in:
Tom Pittenger 2019-02-09 21:03:20 -08:00 committed by Tom Pittenger
parent add2130e07
commit 155a1b7ec7
2 changed files with 8 additions and 8 deletions

View File

@ -63,13 +63,13 @@ const AP_Param::GroupInfo AP_Scheduler::var_info[] = {
AP_Scheduler::AP_Scheduler(scheduler_fastloop_fn_t fastloop_fn) :
_fastloop_fn(fastloop_fn)
{
if (_s_instance) {
if (_singleton) {
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
AP_HAL::panic("Too many schedulers");
#endif
return;
}
_s_instance = this;
_singleton = this;
AP_Param::setup_object_defaults(this, var_info);
@ -85,10 +85,10 @@ AP_Scheduler::AP_Scheduler(scheduler_fastloop_fn_t fastloop_fn) :
/*
* Get the AP_Scheduler singleton
*/
AP_Scheduler *AP_Scheduler::_s_instance = nullptr;
AP_Scheduler *AP_Scheduler::get_instance()
AP_Scheduler *AP_Scheduler::_singleton;
AP_Scheduler *AP_Scheduler::get_singleton()
{
return _s_instance;
return _singleton;
}
// initialise the scheduler
@ -305,7 +305,7 @@ namespace AP {
AP_Scheduler &scheduler()
{
return *AP_Scheduler::get_instance();
return *AP_Scheduler::get_singleton();
}
};

View File

@ -62,8 +62,8 @@ public:
AP_Scheduler(const AP_Scheduler &other) = delete;
AP_Scheduler &operator=(const AP_Scheduler&) = delete;
static AP_Scheduler *get_instance();
static AP_Scheduler *_s_instance;
static AP_Scheduler *get_singleton();
static AP_Scheduler *_singleton;
FUNCTOR_TYPEDEF(task_fn_t, void);