1
1
openmpi/src/mpi/c/comm_set_errhandler.c

51 строка
1.2 KiB
C
Исходник Обычный вид История

/*
* $HEADERS$
*/
#include "lam_config.h"
#include <stdio.h>
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "errhandler/errhandler.h"
#include "communicator/communicator.h"
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
#pragma weak MPI_Comm_set_errhandler = PMPI_Comm_set_errhandler
#endif
#if LAM_PROFILING_DEFINES
#include "mpi/c/profile/defines.h"
#endif
int MPI_Comm_set_errhandler(MPI_Comm comm, MPI_Errhandler errhandler)
{
/* Error checking */
if (MPI_PARAM_CHECK) {
if (NULL == comm ||
MPI_COMM_NULL == comm) {
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Comm_set_errhandler");
} else if (NULL == errhandler ||
MPI_ERRHANDLER_NULL == errhandler ||
LAM_ERRHANDLER_TYPE_COMM != errhandler->eh_mpi_object_type) {
return LAM_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_set_errhandler");
}
}
/* Ditch the old errhandler, and decrement its refcount */
OBJ_RELEASE(comm->error_handler);
/* We have a valid comm and errhandler, so increment its refcount */
comm->error_handler = errhandler;
OBJ_RETAIN(comm->error_handler);
/* All done */
return MPI_SUCCESS;
}