~ubuntu-branches/ubuntu/hardy/openmpi/hardy-updates

« back to all changes in this revision

Viewing changes to orte/mca/iof/base/iof_base_close.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2006-10-15 00:46:11 UTC
  • Revision ID: james.westby@ubuntu.com-20061015004611-uuhxnaxyjmuxfd5h
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
 
3
 *                         University Research and Technology
 
4
 *                         Corporation.  All rights reserved.
 
5
 * Copyright (c) 2004-2005 The University of Tennessee and The University
 
6
 *                         of Tennessee Research Foundation.  All rights
 
7
 *                         reserved.
 
8
 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 
 
9
 *                         University of Stuttgart.  All rights reserved.
 
10
 * Copyright (c) 2004-2005 The Regents of the University of California.
 
11
 *                         All rights reserved.
 
12
 * $COPYRIGHT$
 
13
 * 
 
14
 * Additional copyrights may follow
 
15
 * 
 
16
 * $HEADER$
 
17
 */
 
18
 
 
19
#include "orte_config.h"
 
20
 
 
21
#include <stdio.h>
 
22
 
 
23
#include "opal/event/event.h"
 
24
#include "opal/mca/mca.h"
 
25
#include "opal/mca/base/base.h"
 
26
#include "orte/mca/iof/iof.h"
 
27
#include "orte/mca/iof/base/base.h"
 
28
#include "orte/mca/iof/base/iof_base_endpoint.h"
 
29
 
 
30
 
 
31
int orte_iof_base_close(void)
 
32
{
 
33
    opal_list_item_t* item;
 
34
 
 
35
    /* We only need to flush if an iof component was successfully
 
36
       selected */
 
37
 
 
38
    if (orte_iof_base.iof_flush) {
 
39
        orte_iof_base_flush();
 
40
        orte_iof_base.iof_flush = false;
 
41
    }
 
42
 
 
43
    /* finalize component */
 
44
    if (NULL != orte_iof.iof_finalize) {
 
45
        orte_iof.iof_finalize();
 
46
    }
 
47
 
 
48
    /* shutdown any remaining opened components */
 
49
    if (0 != opal_list_get_size(&orte_iof_base.iof_components_opened)) {
 
50
        mca_base_components_close(orte_iof_base.iof_output, 
 
51
                              &orte_iof_base.iof_components_opened, NULL);
 
52
    }
 
53
 
 
54
    /* final cleanup of resources */
 
55
    OPAL_THREAD_LOCK(&orte_iof_base.iof_lock);
 
56
    while((item = opal_list_remove_first(&orte_iof_base.iof_endpoints)) != NULL) {
 
57
        OBJ_RELEASE(item);
 
58
    }
 
59
    OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock);
 
60
 
 
61
    if (NULL != orte_iof_base.iof_service) {
 
62
        orte_ns.free_name(&(orte_iof_base.iof_service));
 
63
    }
 
64
 
 
65
    return ORTE_SUCCESS;
 
66
}
 
67