1 /* Copyright (c) 2007-2023. 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;
14 namespace simgrid::smpi {
16 MPI_Errhandler Errhandler::f2c(int id) {
17 if (F2C::lookup() != nullptr && id >= 0) {
18 return static_cast<MPI_Errhandler>(F2C::lookup()->at(id));
20 return MPI_ERRHANDLER_NULL;
24 void Errhandler::call(MPI_Comm comm, int errorcode) const
26 comm_func_(&comm, &errorcode);
29 void Errhandler::call(MPI_Win win, int errorcode) const
31 win_func_(&win, &errorcode);
34 void Errhandler::call(MPI_File file, int errorcode) const
36 file_func_(&file, &errorcode);
39 void Errhandler::ref()
44 void Errhandler::unref(Errhandler* errhandler){
45 if(errhandler == MPI_ERRORS_ARE_FATAL || errhandler == MPI_ERRORS_RETURN)
47 errhandler->refcount_--;
48 if(errhandler->refcount_==0){
49 F2C::free_f(errhandler->f2c_id());
54 } // namespace simgrid::smpi