2004-06-15 23:07:45 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-06-15 23:07:45 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2005-08-13 01:42:07 +04:00
|
|
|
#include "ompi/include/constants.h"
|
2004-06-15 23:07:45 +04:00
|
|
|
#include "mca/mca.h"
|
|
|
|
#include "mca/base/base.h"
|
|
|
|
#include "mca/mpool/mpool.h"
|
|
|
|
#include "mca/mpool/base/base.h"
|
2005-09-14 06:17:04 +04:00
|
|
|
#include "mpool_base_mem_cb.h"
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2005-09-17 02:22:03 +04:00
|
|
|
extern int mca_mpool_base_use_mem_hooks;
|
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
int mca_mpool_base_close(void)
|
|
|
|
{
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t *item;
|
2004-06-15 23:07:45 +04:00
|
|
|
mca_mpool_base_selected_module_t *sm;
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/* Finalize all the mpool components and free their list items */
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
for (item = opal_list_remove_first(&mca_mpool_base_modules);
|
2004-06-15 23:07:45 +04:00
|
|
|
NULL != item;
|
2005-07-03 20:22:16 +04:00
|
|
|
item = opal_list_remove_first(&mca_mpool_base_modules)) {
|
2004-06-15 23:07:45 +04:00
|
|
|
sm = (mca_mpool_base_selected_module_t *) item;
|
|
|
|
|
|
|
|
/* Blatently ignore the return code (what would we do to recover,
|
2004-08-02 04:24:22 +04:00
|
|
|
anyway? This component is going away, so errors don't matter
|
2005-01-15 16:20:26 +03:00
|
|
|
anymore). Note that it's legal for the module to have NULL for
|
|
|
|
the finalize function. */
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2005-01-15 16:20:26 +03:00
|
|
|
if (NULL != sm->mpool_module->mpool_finalize) {
|
|
|
|
sm->mpool_module->mpool_finalize(sm->mpool_module);
|
|
|
|
}
|
2005-01-15 00:58:02 +03:00
|
|
|
OBJ_RELEASE(sm);
|
2004-06-15 23:07:45 +04:00
|
|
|
}
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/* Close all remaining available components (may be one if this is a
|
2004-06-15 23:07:45 +04:00
|
|
|
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_base_components_close(mca_mpool_base_output,
|
|
|
|
&mca_mpool_base_components, NULL);
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2005-09-14 06:17:04 +04:00
|
|
|
/* deregister memory free callback */
|
2005-09-17 02:22:03 +04:00
|
|
|
if(mca_mpool_base_use_mem_hooks && opal_mem_free_is_supported()) {
|
|
|
|
opal_mem_free_unregister_handler(mca_mpool_base_mem_cb);
|
|
|
|
}
|
2004-06-15 23:07:45 +04:00
|
|
|
/* All done */
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|