mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-29 22:40:34 +08:00
uORBManager: allocate instance on first use
Previously _Instance was statically initialized. Now it is allocated at first use. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -44,13 +44,17 @@
|
||||
|
||||
|
||||
//========================= Static initializations =================
|
||||
uORB::Manager uORB::Manager::_Instance;
|
||||
uORB::Manager *uORB::Manager::_Instance = nullptr;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
uORB::Manager *uORB::Manager::get_instance()
|
||||
{
|
||||
return &_Instance;
|
||||
if (_Instance == nullptr) {
|
||||
_Instance = new uORB::Manager();
|
||||
}
|
||||
|
||||
return _Instance;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user