1
1

use the new OPAL_HASH_TABLE_FOREACH convenience macro

Этот коммит содержится в:
Gilles Gouaillardet 2016-10-03 16:59:12 +09:00
родитель 23a8f764bd
Коммит c92e9a5406
3 изменённых файлов: 7 добавлений и 26 удалений

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2011 UT-Battelle, LLC. All rights reserved. * Copyright (c) 2011 UT-Battelle, LLC. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science * Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
@ -144,13 +144,10 @@ mca_btl_ugni_module_finalize (struct mca_btl_base_module_t *btl)
/* close all open connections and release endpoints */ /* close all open connections and release endpoints */
if (ugni_module->initialized) { if (ugni_module->initialized) {
rc = opal_hash_table_get_first_key_uint64 (&ugni_module->id_to_endpoint, &key, (void **) &ep, &node); OPAL_HASH_TABLE_FOREACH(key, uint64, ep, &ugni_module->id_to_endpoint) {
while (OPAL_SUCCESS == rc) {
if (NULL != ep) { if (NULL != ep) {
mca_btl_ugni_release_ep (ep); mca_btl_ugni_release_ep (ep);
} }
rc = opal_hash_table_get_next_key_uint64 (&ugni_module->id_to_endpoint, &key, (void **) &ep, node, &node);
} }
if (mca_btl_ugni_component.progress_thread_enabled) { if (mca_btl_ugni_component.progress_thread_enabled) {

Просмотреть файл

@ -13,7 +13,7 @@
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights * Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
@ -79,8 +79,6 @@ static int orte_oob_base_close(void)
mca_base_component_list_item_t *cli; mca_base_component_list_item_t *cli;
opal_object_t *value; opal_object_t *value;
uint64_t key; uint64_t key;
void *node;
int rc;
/* shutdown all active transports */ /* shutdown all active transports */
while (NULL != (cli = (mca_base_component_list_item_t *) opal_list_remove_first (&orte_oob_base.actives))) { while (NULL != (cli = (mca_base_component_list_item_t *) opal_list_remove_first (&orte_oob_base.actives))) {
@ -95,14 +93,10 @@ static int orte_oob_base_close(void)
OBJ_DESTRUCT(&orte_oob_base.actives); OBJ_DESTRUCT(&orte_oob_base.actives);
/* release all peers from the hash table */ /* release all peers from the hash table */
rc = opal_hash_table_get_first_key_uint64 (&orte_oob_base.peers, &key, OPAL_HASH_TABLE_FOREACH(key, uint64, value, &orte_oob_base.peers) {
(void **) &value, &node);
while (OPAL_SUCCESS == rc) {
if (NULL != value) { if (NULL != value) {
OBJ_RELEASE(value); OBJ_RELEASE(value);
} }
rc = opal_hash_table_get_next_key_uint64 (&orte_oob_base.peers, &key,
(void **) &value, node, &node);
} }
OBJ_DESTRUCT(&orte_oob_base.peers); OBJ_DESTRUCT(&orte_oob_base.peers);

Просмотреть файл

@ -14,6 +14,8 @@
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved. * Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -147,12 +149,10 @@ static void tcp_init(void)
static void tcp_fini(void) static void tcp_fini(void)
{ {
uint64_t ui64; uint64_t ui64;
char *nptr;
mca_oob_tcp_peer_t *peer; mca_oob_tcp_peer_t *peer;
/* cleanup all peers */ /* cleanup all peers */
if (OPAL_SUCCESS == opal_hash_table_get_first_key_uint64(&mca_oob_tcp_module.peers, &ui64, OPAL_HASH_TABLE_FOREACH(ui64, uint64, peer, &mca_oob_tcp_module.peers) {
(void**)&peer, (void**)&nptr)) {
opal_output_verbose(2, orte_oob_base_framework.framework_output, opal_output_verbose(2, orte_oob_base_framework.framework_output,
"%s RELEASING PEER OBJ %s", "%s RELEASING PEER OBJ %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
@ -160,16 +160,6 @@ static void tcp_fini(void)
if (NULL != peer) { if (NULL != peer) {
OBJ_RELEASE(peer); OBJ_RELEASE(peer);
} }
while (OPAL_SUCCESS == opal_hash_table_get_next_key_uint64(&mca_oob_tcp_module.peers, &ui64,
(void**)&peer, nptr, (void**)&nptr)) {
opal_output_verbose(2, orte_oob_base_framework.framework_output,
"%s RELEASING PEER OBJ %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
(NULL == peer) ? "NULL" : ORTE_NAME_PRINT(&peer->name));
if (NULL != peer) {
OBJ_RELEASE(peer);
}
}
} }
OBJ_DESTRUCT(&mca_oob_tcp_module.peers); OBJ_DESTRUCT(&mca_oob_tcp_module.peers);