From 35ddd0d0b29e52ce2b1887b80d9c4dd49920faeb Mon Sep 17 00:00:00 2001 From: Winter Date: Sat, 30 Jan 2016 13:07:19 +0100 Subject: [PATCH] mtapi_c: changed group deleted attribute to atomic --- mtapi_c/src/embb_mtapi_group_t.c | 8 ++++---- mtapi_c/src/embb_mtapi_group_t.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mtapi_c/src/embb_mtapi_group_t.c b/mtapi_c/src/embb_mtapi_group_t.c index 9e3b0a5..ed9c548 100644 --- a/mtapi_c/src/embb_mtapi_group_t.c +++ b/mtapi_c/src/embb_mtapi_group_t.c @@ -55,7 +55,7 @@ void embb_mtapi_group_initialize(embb_mtapi_group_t * that) { assert(MTAPI_NULL != that); 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; embb_mtapi_task_queue_initialize(&that->queue); } @@ -67,7 +67,7 @@ void embb_mtapi_group_initialize_with_node( assert(MTAPI_NULL != node); 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; embb_mtapi_task_queue_initialize_with_capacity( &that->queue, node->attributes.queue_limit); @@ -76,7 +76,7 @@ void embb_mtapi_group_initialize_with_node( void embb_mtapi_group_finalize(embb_mtapi_group_t * that) { assert(MTAPI_NULL != that); - that->deleted = MTAPI_TRUE; + embb_atomic_store_int(&that->deleted, MTAPI_TRUE); that->num_tasks.internal_variable = 0; embb_mtapi_task_queue_finalize(&that->queue); } @@ -372,7 +372,7 @@ void mtapi_group_delete( embb_mtapi_group_pool_get_storage_for_handle( node->group_pool, group); - if (local_group->deleted) { + if (embb_atomic_load_int(&local_group->deleted)) { local_status = MTAPI_ERR_GROUP_INVALID; } else { embb_mtapi_group_finalize(local_group); diff --git a/mtapi_c/src/embb_mtapi_group_t.h b/mtapi_c/src/embb_mtapi_group_t.h index 9f4a401..34ebe92 100644 --- a/mtapi_c/src/embb_mtapi_group_t.h +++ b/mtapi_c/src/embb_mtapi_group_t.h @@ -55,7 +55,7 @@ struct embb_mtapi_group_struct { mtapi_group_hndl_t handle; mtapi_group_id_t group_id; - volatile mtapi_boolean_t deleted; + embb_atomic_int deleted; embb_atomic_int num_tasks; mtapi_group_attributes_t attributes; embb_mtapi_task_queue_t queue; -- libgit2 0.26.0