Commit e59aa0dd authored by Dorel Coman's avatar Dorel Coman Committed by Oliver Horst
Browse files

memguard: fixed mechanism for blocking tasks from running before the...

memguard: fixed mechanism for blocking tasks from running before the memguard_notify_new_task_created() is called for them.
We keep them suspended until this function is called.
parent 27fb9eee
......@@ -354,7 +354,22 @@ void memguard_notify_new_task_created(TaskHandle_t task_handle, uint32_t bandwid
vTaskSetMemguardTaskInfo(task_handle, new_task_info);
memguard_vTaskSuspend(task_handle, new_task_info);
new_task_info->tsk_susp_by_user = pdFALSE;
new_task_info->tsk_susp_by_memguard = pdTRUE;
/* The order of the next 2 ifs is important in order to don't get a
configASSERT() fail. If we try to resume any task which was not created
already, we will get an error inside the 2 functions below.
If another task has a NULL pointer as task_info the system will be halted
by a configAssert()*/
} else if (task_handle == xTaskGetIdleTaskHandle()) {
} else if(task_handle == xTimerGetTimerDaemonTaskHandle()){
} else {
configASSERT(task_handle != NULL);
......@@ -406,6 +421,17 @@ BaseType_t memguard_can_task_resume(TaskHandle_t xTask)
memguard_task_info *task_info = (memguard_task_info *) pvTaskGetMemguardTaskInfo(xTask);
BaseType_t can_task_resume;
if(task_info != NULL){
can_task_resume = task_info->tsk_susp_by_memguard;
} else if (xTask == xTaskGetIdleTaskHandle()) {
can_task_resume = pdTRUE;
} else if(xTask == xTimerGetTimerDaemonTaskHandle()){
can_task_resume = pdTRUE;
#if (INCLUDE_memguard_benchmark)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment