diff options
author | Jean-François Milants <jf@codingfield.com> | 2021-06-12 10:58:28 +0200 |
---|---|---|
committer | Jean-François Milants <jf@codingfield.com> | 2021-06-12 10:58:28 +0200 |
commit | 6d524ebea2c97e309633d5e01c3a1e37c182f27d (patch) | |
tree | 3f9c7f96f0fab64f581035c72480596a4cc4db43 /src/systemtask | |
parent | b1925ff28638dd4b8400c4d0c49d796d8990b1af (diff) |
Move most of the code from the constructor of the objects statically initialized in main() into Start()/Init() functions to avoid Static Initialization Order Fiasco (https://en.cppreference.com/w/cpp/language/siof). See https://github.com/JF002/InfiniTime/pull/415#issuecomment-859004238.
Diffstat (limited to 'src/systemtask')
-rw-r--r-- | src/systemtask/SystemTask.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 4799624a..38e9793c 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -81,10 +81,11 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi, motionController{motionController}, displayApp{displayApp}, heartRateApp(heartRateApp) { - systemTasksMsgQueue = xQueueCreate(10, 1); + } void SystemTask::Start() { + systemTasksMsgQueue = xQueueCreate(10, 1); if (pdPASS != xTaskCreate(SystemTask::Process, "MAIN", 350, this, 0, &taskHandle)) APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); } |