Commit 73578401 by Tobias Langer

Endless loop bug fix.

On releasing all resources, the node waits for the completion of all
tasks which are associated to a specific action. Since we never
incremented the task counter for actions, this loop spun.
parent c928c9f8
...@@ -638,14 +638,23 @@ mtapi_boolean_t embb_mtapi_scheduler_schedule_task( ...@@ -638,14 +638,23 @@ mtapi_boolean_t embb_mtapi_scheduler_schedule_task(
assert(MTAPI_NULL != node); assert(MTAPI_NULL != node);
if (embb_mtapi_action_pool_is_handle_valid(
node->action_pool, task->action)) {
#ifdef EMBB_HARD_REALTIME #ifdef EMBB_HARD_REALTIME
if (scheduler->mode == GLOBAL_EDF) { if (scheduler->mode == GLOBAL_EDF) {
embb_mtapi_task_queue_push(&node->global_task_queue, task); /* fetch action and schedule */
pushed = MTAPI_TRUE; embb_mtapi_action_t* local_action =
embb_mtapi_action_pool_get_storage_for_handle(
node->action_pool, task->action);
/* one more task in flight for this action */
embb_atomic_fetch_and_add_int(&local_action->num_tasks, 1);
pushed = embb_mtapi_task_queue_push(&node->global_task_queue, task);
if (!pushed) {
embb_atomic_fetch_and_add_int(&local_action->num_tasks, -1);
}
} else { } else {
#endif /*EMBB_HARD_REALTIME*/ #endif /*EMBB_HARD_REALTIME*/
if (embb_mtapi_action_pool_is_handle_valid(
node->action_pool, task->action)) {
embb_mtapi_queue_t* local_queue = MTAPI_NULL; embb_mtapi_queue_t* local_queue = MTAPI_NULL;
/* fetch action and schedule */ /* fetch action and schedule */
embb_mtapi_action_t* local_action = embb_mtapi_action_t* local_action =
...@@ -704,10 +713,10 @@ mtapi_boolean_t embb_mtapi_scheduler_schedule_task( ...@@ -704,10 +713,10 @@ mtapi_boolean_t embb_mtapi_scheduler_schedule_task(
/* task could not be launched */ /* task could not be launched */
embb_atomic_fetch_and_add_int(&local_action->num_tasks, -1); embb_atomic_fetch_and_add_int(&local_action->num_tasks, -1);
} }
}
#ifdef EMBB_HARD_REALTIME #ifdef EMBB_HARD_REALTIME
} }
#endif /*EMBB_HARD_REALTIME*/ #endif /*EMBB_HARD_REALTIME*/
}
return pushed; return pushed;
} }
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 sign in to comment