Commit 35ddd0d0 by Winter

mtapi_c: changed group deleted attribute to atomic

parent d06a82f0
...@@ -55,7 +55,7 @@ void embb_mtapi_group_initialize(embb_mtapi_group_t * that) { ...@@ -55,7 +55,7 @@ void embb_mtapi_group_initialize(embb_mtapi_group_t * that) {
assert(MTAPI_NULL != that); assert(MTAPI_NULL != that);
that->group_id = MTAPI_GROUP_ID_NONE; that->group_id = MTAPI_GROUP_ID_NONE;
that->deleted = MTAPI_FALSE; embb_atomic_store_int(&that->deleted, MTAPI_FALSE);
that->num_tasks.internal_variable = 0; that->num_tasks.internal_variable = 0;
embb_mtapi_task_queue_initialize(&that->queue); embb_mtapi_task_queue_initialize(&that->queue);
} }
...@@ -67,7 +67,7 @@ void embb_mtapi_group_initialize_with_node( ...@@ -67,7 +67,7 @@ void embb_mtapi_group_initialize_with_node(
assert(MTAPI_NULL != node); assert(MTAPI_NULL != node);
that->group_id = MTAPI_GROUP_ID_NONE; that->group_id = MTAPI_GROUP_ID_NONE;
that->deleted = MTAPI_FALSE; embb_atomic_store_int(&that->deleted, MTAPI_FALSE);
that->num_tasks.internal_variable = 0; that->num_tasks.internal_variable = 0;
embb_mtapi_task_queue_initialize_with_capacity( embb_mtapi_task_queue_initialize_with_capacity(
&that->queue, node->attributes.queue_limit); &that->queue, node->attributes.queue_limit);
...@@ -76,7 +76,7 @@ void embb_mtapi_group_initialize_with_node( ...@@ -76,7 +76,7 @@ void embb_mtapi_group_initialize_with_node(
void embb_mtapi_group_finalize(embb_mtapi_group_t * that) { void embb_mtapi_group_finalize(embb_mtapi_group_t * that) {
assert(MTAPI_NULL != that); assert(MTAPI_NULL != that);
that->deleted = MTAPI_TRUE; embb_atomic_store_int(&that->deleted, MTAPI_TRUE);
that->num_tasks.internal_variable = 0; that->num_tasks.internal_variable = 0;
embb_mtapi_task_queue_finalize(&that->queue); embb_mtapi_task_queue_finalize(&that->queue);
} }
...@@ -372,7 +372,7 @@ void mtapi_group_delete( ...@@ -372,7 +372,7 @@ void mtapi_group_delete(
embb_mtapi_group_pool_get_storage_for_handle( embb_mtapi_group_pool_get_storage_for_handle(
node->group_pool, group); node->group_pool, group);
if (local_group->deleted) { if (embb_atomic_load_int(&local_group->deleted)) {
local_status = MTAPI_ERR_GROUP_INVALID; local_status = MTAPI_ERR_GROUP_INVALID;
} else { } else {
embb_mtapi_group_finalize(local_group); embb_mtapi_group_finalize(local_group);
......
...@@ -55,7 +55,7 @@ struct embb_mtapi_group_struct { ...@@ -55,7 +55,7 @@ struct embb_mtapi_group_struct {
mtapi_group_hndl_t handle; mtapi_group_hndl_t handle;
mtapi_group_id_t group_id; mtapi_group_id_t group_id;
volatile mtapi_boolean_t deleted; embb_atomic_int deleted;
embb_atomic_int num_tasks; embb_atomic_int num_tasks;
mtapi_group_attributes_t attributes; mtapi_group_attributes_t attributes;
embb_mtapi_task_queue_t queue; embb_mtapi_task_queue_t queue;
......
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