diff --git a/mtapi_c/src/embb_mtapi_action_plugin_t.c b/mtapi_c/src/embb_mtapi_action_plugin_t.c index 11462ec..18e0841 100644 --- a/mtapi_c/src/embb_mtapi_action_plugin_t.c +++ b/mtapi_c/src/embb_mtapi_action_plugin_t.c @@ -35,7 +35,8 @@ mtapi_action_hndl_t mtapi_ext_plugin_action_create( 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_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* node_local_data, MTAPI_IN mtapi_size_t node_local_data_size, @@ -72,8 +73,7 @@ mtapi_action_hndl_t mtapi_ext_plugin_action_create( if (MTAPI_NULL != attributes) { new_action->attributes = *attributes; local_status = MTAPI_SUCCESS; - } - else { + } else { /* use the default */ mtapi_actionattr_init(&new_action->attributes, &local_status); } @@ -86,21 +86,17 @@ mtapi_action_hndl_t mtapi_ext_plugin_action_create( if (MTAPI_SUCCESS == local_status) { action_handle = new_action->handle; embb_mtapi_job_add_action(job, new_action); - } - else { + } else { embb_mtapi_action_pool_deallocate(node->action_pool, new_action); } - } - else { + } else { /* no more space left in action pool */ local_status = MTAPI_ERR_ACTION_LIMIT; } - } - else { + } else { local_status = MTAPI_ERR_JOB_INVALID; } - } - else { + } else { embb_mtapi_log_error("mtapi not initialized\n"); local_status = MTAPI_ERR_NODE_NOTINIT; } diff --git a/mtapi_c/src/embb_mtapi_task_t.c b/mtapi_c/src/embb_mtapi_task_t.c index 45810e5..29ac633 100644 --- a/mtapi_c/src/embb_mtapi_task_t.c +++ b/mtapi_c/src/embb_mtapi_task_t.c @@ -239,8 +239,10 @@ static mtapi_task_hndl_t embb_mtapi_task_start( if (local_action->is_plugin_action) { /* schedule plugin task */ mtapi_status_t plugin_status = MTAPI_ERR_UNKNOWN; - local_action->plugin_task_start_function(task_hndl, &plugin_status); - was_scheduled = (MTAPI_SUCCESS == plugin_status) ? MTAPI_TRUE : MTAPI_FALSE; + local_action->plugin_task_start_function( + task_hndl, &plugin_status); + was_scheduled = (MTAPI_SUCCESS == plugin_status) ? + MTAPI_TRUE : MTAPI_FALSE; } else { /* schedule local task */ was_scheduled = @@ -465,9 +467,11 @@ void mtapi_task_cancel( embb_mtapi_task_set_state(local_task, MTAPI_TASK_CANCELLED); /* 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_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) { local_action->plugin_task_cancel_function(task, &local_status); } diff --git a/mtapi_c/test/embb_mtapi_test_plugin.cc b/mtapi_c/test/embb_mtapi_test_plugin.cc index 81116f2..4240fc2 100644 --- a/mtapi_c/test/embb_mtapi_test_plugin.cc +++ b/mtapi_c/test/embb_mtapi_test_plugin.cc @@ -47,16 +47,19 @@ int plugin_thread_function(void * args) { EMBB_UNUSED(args); while (embb_atomic_load_int(&plugin_running)) { /* 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(); if (embb_atomic_load_int(&plugin_running)) { if (embb_mtapi_node_is_initialized()) { 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_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); } }