1
1

make sure dont create multiple entries for published endpoints

This commit was SVN r6149.
Этот коммит содержится в:
Tim Woodall 2005-06-23 16:10:46 +00:00
родитель e62daf8a8e
Коммит 6cc44d2ba2
2 изменённых файлов: 20 добавлений и 2 удалений

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

@ -225,6 +225,7 @@ int orte_iof_base_endpoint_create(
OMPI_THREAD_LOCK(&orte_iof_base.iof_lock);
if((endpoint = orte_iof_base_endpoint_lookup(proc,mode,tag)) != NULL) {
OBJ_RELEASE(endpoint);
OMPI_THREAD_UNLOCK(&orte_iof_base.iof_lock);
return OMPI_SUCCESS;
}

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

@ -38,9 +38,27 @@ int orte_iof_svc_pub_create(
orte_ns_cmp_bitmask_t pub_mask,
orte_iof_base_tag_t pub_tag)
{
orte_iof_svc_pub_t* pub = OBJ_NEW(orte_iof_svc_pub_t);
orte_iof_svc_pub_t* pub;
ompi_list_item_t* item;
OMPI_THREAD_LOCK(&mca_iof_svc_component.svc_lock);
ompi_list_append(&mca_iof_svc_component.svc_published, &pub->super);
/* has this endpoint already been published */
for(item = ompi_list_get_first(&mca_iof_svc_component.svc_published);
item != ompi_list_get_end(&mca_iof_svc_component.svc_published);
item = ompi_list_get_next(item)) {
pub = (orte_iof_svc_pub_t*)item;
if(orte_ns.compare(pub_mask,pub_name,&pub->pub_name) == 0 &&
orte_ns.compare(ORTE_NS_CMP_ALL,pub_proxy,&pub->pub_proxy) == 0 &&
pub_tag == pub->pub_tag) {
OMPI_THREAD_UNLOCK(&mca_iof_svc_component.svc_lock);
return OMPI_SUCCESS;
}
}
/* create a new entry for this endponit */
pub = OBJ_NEW(orte_iof_svc_pub_t);
pub->pub_name = *pub_name;
pub->pub_proxy = *pub_proxy;
pub->pub_mask = pub_mask;
@ -48,7 +66,6 @@ int orte_iof_svc_pub_create(
pub->pub_endpoint = orte_iof_base_endpoint_match(pub_name,pub_mask,pub_tag);
/* append this published endpoint to any matching subscription */
OMPI_THREAD_LOCK(&mca_iof_svc_component.svc_lock);
for(item = ompi_list_get_first(&mca_iof_svc_component.svc_subscribed);
item != ompi_list_get_end(&mca_iof_svc_component.svc_subscribed);
item = ompi_list_get_next(item)) {