1 /* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "smpi_errhandler.hpp"
11 simgrid::smpi::Errhandler smpi_MPI_ERRORS_RETURN;
12 simgrid::smpi::Errhandler smpi_MPI_ERRORS_ARE_FATAL;
17 MPI_Errhandler Errhandler::f2c(int id) {
18 if (F2C::lookup() != nullptr && id >= 0) {
19 return static_cast<MPI_Errhandler>(F2C::lookup()->at(id));
21 return MPI_ERRHANDLER_NULL;
25 void Errhandler::call(MPI_Comm comm, int errorcode) const
27 comm_func_(&comm, &errorcode);
30 void Errhandler::call(MPI_Win win, int errorcode) const
32 win_func_(&win, &errorcode);
35 void Errhandler::call(MPI_File file, int errorcode) const
37 file_func_(&file, &errorcode);
40 void Errhandler::ref()
45 void Errhandler::unref(Errhandler* errhandler){
46 if(errhandler == MPI_ERRORS_ARE_FATAL || errhandler == MPI_ERRORS_RETURN)
48 errhandler->refcount_--;
49 if(errhandler->refcount_==0){
50 F2C::free_f(errhandler->f2c_id());