Commit 679c1bd4 by Marcus Winter

mtapi_c: fixed cpplint warnings

parent 318574bc
...@@ -35,7 +35,8 @@ mtapi_action_hndl_t mtapi_ext_plugin_action_create( ...@@ -35,7 +35,8 @@ mtapi_action_hndl_t mtapi_ext_plugin_action_create(
MTAPI_IN mtapi_job_id_t job_id, MTAPI_IN mtapi_job_id_t job_id,
MTAPI_IN mtapi_ext_plugin_task_start_function_t task_start_function, MTAPI_IN mtapi_ext_plugin_task_start_function_t task_start_function,
MTAPI_IN mtapi_ext_plugin_task_cancel_function_t task_cancel_function, MTAPI_IN mtapi_ext_plugin_task_cancel_function_t task_cancel_function,
MTAPI_IN mtapi_ext_plugin_action_finalize_function_t action_finalize_function, MTAPI_IN mtapi_ext_plugin_action_finalize_function_t
action_finalize_function,
MTAPI_IN void* plugin_data, MTAPI_IN void* plugin_data,
MTAPI_IN void* node_local_data, MTAPI_IN void* node_local_data,
MTAPI_IN mtapi_size_t node_local_data_size, MTAPI_IN mtapi_size_t node_local_data_size,
...@@ -72,8 +73,7 @@ mtapi_action_hndl_t mtapi_ext_plugin_action_create( ...@@ -72,8 +73,7 @@ mtapi_action_hndl_t mtapi_ext_plugin_action_create(
if (MTAPI_NULL != attributes) { if (MTAPI_NULL != attributes) {
new_action->attributes = *attributes; new_action->attributes = *attributes;
local_status = MTAPI_SUCCESS; local_status = MTAPI_SUCCESS;
} } else {
else {
/* use the default */ /* use the default */
mtapi_actionattr_init(&new_action->attributes, &local_status); mtapi_actionattr_init(&new_action->attributes, &local_status);
} }
...@@ -86,21 +86,17 @@ mtapi_action_hndl_t mtapi_ext_plugin_action_create( ...@@ -86,21 +86,17 @@ mtapi_action_hndl_t mtapi_ext_plugin_action_create(
if (MTAPI_SUCCESS == local_status) { if (MTAPI_SUCCESS == local_status) {
action_handle = new_action->handle; action_handle = new_action->handle;
embb_mtapi_job_add_action(job, new_action); embb_mtapi_job_add_action(job, new_action);
} } else {
else {
embb_mtapi_action_pool_deallocate(node->action_pool, new_action); embb_mtapi_action_pool_deallocate(node->action_pool, new_action);
} }
} } else {
else {
/* no more space left in action pool */ /* no more space left in action pool */
local_status = MTAPI_ERR_ACTION_LIMIT; local_status = MTAPI_ERR_ACTION_LIMIT;
} }
} } else {
else {
local_status = MTAPI_ERR_JOB_INVALID; local_status = MTAPI_ERR_JOB_INVALID;
} }
} } else {
else {
embb_mtapi_log_error("mtapi not initialized\n"); embb_mtapi_log_error("mtapi not initialized\n");
local_status = MTAPI_ERR_NODE_NOTINIT; local_status = MTAPI_ERR_NODE_NOTINIT;
} }
......
...@@ -239,8 +239,10 @@ static mtapi_task_hndl_t embb_mtapi_task_start( ...@@ -239,8 +239,10 @@ static mtapi_task_hndl_t embb_mtapi_task_start(
if (local_action->is_plugin_action) { if (local_action->is_plugin_action) {
/* schedule plugin task */ /* schedule plugin task */
mtapi_status_t plugin_status = MTAPI_ERR_UNKNOWN; mtapi_status_t plugin_status = MTAPI_ERR_UNKNOWN;
local_action->plugin_task_start_function(task_hndl, &plugin_status); local_action->plugin_task_start_function(
was_scheduled = (MTAPI_SUCCESS == plugin_status) ? MTAPI_TRUE : MTAPI_FALSE; task_hndl, &plugin_status);
was_scheduled = (MTAPI_SUCCESS == plugin_status) ?
MTAPI_TRUE : MTAPI_FALSE;
} else { } else {
/* schedule local task */ /* schedule local task */
was_scheduled = was_scheduled =
...@@ -465,9 +467,11 @@ void mtapi_task_cancel( ...@@ -465,9 +467,11 @@ void mtapi_task_cancel(
embb_mtapi_task_set_state(local_task, MTAPI_TASK_CANCELLED); embb_mtapi_task_set_state(local_task, MTAPI_TASK_CANCELLED);
/* call plugin action cancel function */ /* call plugin action cancel function */
if (embb_mtapi_action_pool_is_handle_valid(node->action_pool, local_task->action)) { if (embb_mtapi_action_pool_is_handle_valid(
node->action_pool, local_task->action)) {
embb_mtapi_action_t* local_action = embb_mtapi_action_t* local_action =
embb_mtapi_action_pool_get_storage_for_handle(node->action_pool, local_task->action); embb_mtapi_action_pool_get_storage_for_handle(
node->action_pool, local_task->action);
if (local_action->is_plugin_action) { if (local_action->is_plugin_action) {
local_action->plugin_task_cancel_function(task, &local_status); local_action->plugin_task_cancel_function(task, &local_status);
} }
......
...@@ -47,16 +47,19 @@ int plugin_thread_function(void * args) { ...@@ -47,16 +47,19 @@ int plugin_thread_function(void * args) {
EMBB_UNUSED(args); EMBB_UNUSED(args);
while (embb_atomic_load_int(&plugin_running)) { while (embb_atomic_load_int(&plugin_running)) {
/* wait for incoming task */ /* wait for incoming task */
while (embb_atomic_load_int(&plugin_running) && !embb_atomic_load_int(&plugin_task_available)) while (embb_atomic_load_int(&plugin_running) &&
!embb_atomic_load_int(&plugin_task_available))
embb_thread_yield(); embb_thread_yield();
if (embb_atomic_load_int(&plugin_running)) { if (embb_atomic_load_int(&plugin_running)) {
if (embb_mtapi_node_is_initialized()) { if (embb_mtapi_node_is_initialized()) {
embb_mtapi_node_t * node = embb_mtapi_node_get_instance(); embb_mtapi_node_t * node = embb_mtapi_node_get_instance();
if (embb_mtapi_task_pool_is_handle_valid(node->task_pool, plugin_task)) { if (embb_mtapi_task_pool_is_handle_valid(
node->task_pool, plugin_task)) {
embb_mtapi_task_t * local_task = embb_mtapi_task_t * local_task =
embb_mtapi_task_pool_get_storage_for_handle(node->task_pool, plugin_task); embb_mtapi_task_pool_get_storage_for_handle(
node->task_pool, plugin_task);
embb_mtapi_task_set_state(local_task, MTAPI_TASK_COMPLETED); embb_mtapi_task_set_state(local_task, MTAPI_TASK_COMPLETED);
} }
} }
......
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