Fix some data race conditions
@@ -545,7 +545,9 @@ static inline void MsgAlloc_ClearLuosTask(uint16_t luos_task_id)
LUOS_ASSERT((luos_task_id <= luos_tasks_stack_id) || (luos_tasks_stack_id <= MAX_MSG_NB));
for (uint16_t rm = luos_task_id; rm < luos_tasks_stack_id; rm++)
{
+ LuosHAL_SetIrqState(false);
luos_tasks[rm] = luos_tasks[rm + 1];
+ LuosHAL_SetIrqState(true);
}
LuosHAL_SetIrqState(false);
if (luos_tasks_stack_id != 0)
@@ -575,6 +577,7 @@ void MsgAlloc_LuosTaskAlloc(ll_container_t *container_concerned_by_current_msg,
}
}
// fill the informations of the message in this slot
+ LuosHAL_SetIrqState(false);
luos_tasks[luos_tasks_stack_id].msg_pt = concerned_msg;
luos_tasks[luos_tasks_stack_id].ll_container_pt = container_concerned_by_current_msg;
if (luos_tasks_stack_id == 0)
@@ -582,6 +585,7 @@ void MsgAlloc_LuosTaskAlloc(ll_container_t *container_concerned_by_current_msg,
MsgAlloc_OldestMsgCandidate(luos_tasks[0].msg_pt);
}
luos_tasks_stack_id++;
+ LuosHAL_SetIrqState(true);
// luos task memory usage
uint8_t stat = (uint8_t)(((uint32_t)luos_tasks_stack_id * 100) / (MAX_MSG_NB));
if (stat > mem_stat->luos_stack_ratio)
