X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9104957deccc59e0e804215d5db498fabfd40d29..ea02d47c2ee462e84798356e4dda87b1467e22b8:/src/smpi/mpi/smpi_errhandler.cpp diff --git a/src/smpi/mpi/smpi_errhandler.cpp b/src/smpi/mpi/smpi_errhandler.cpp index 5db2285323..74e224226f 100644 --- a/src/smpi/mpi/smpi_errhandler.cpp +++ b/src/smpi/mpi/smpi_errhandler.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -8,32 +8,32 @@ #include -simgrid::smpi::Errhandler mpi_MPI_ERRORS_RETURN; -MPI_Errhandler MPI_ERRORS_RETURN=&mpi_MPI_ERRORS_RETURN; -simgrid::smpi::Errhandler mpi_MPI_ERRORS_ARE_FATAL; -MPI_Errhandler MPI_ERRORS_ARE_FATAL=&mpi_MPI_ERRORS_ARE_FATAL; +simgrid::smpi::Errhandler smpi_MPI_ERRORS_RETURN; +simgrid::smpi::Errhandler smpi_MPI_ERRORS_ARE_FATAL; namespace simgrid{ namespace smpi{ MPI_Errhandler Errhandler::f2c(int id) { - if(F2C::f2c_lookup() != nullptr && id >= 0) { - char key[KEY_SIZE]; - return static_cast(F2C::f2c_lookup()->at(get_key(key, id))); + if (F2C::lookup() != nullptr && id >= 0) { + return static_cast(F2C::lookup()->at(id)); } else { - return static_cast(MPI_ERRHANDLER_NULL); + return MPI_ERRHANDLER_NULL; } } -void Errhandler::call(MPI_Comm comm, int errorcode){ +void Errhandler::call(MPI_Comm comm, int errorcode) const +{ comm_func_(&comm, &errorcode); } -void Errhandler::call(MPI_Win win, int errorcode){ +void Errhandler::call(MPI_Win win, int errorcode) const +{ win_func_(&win, &errorcode); } -void Errhandler::call(MPI_File file, int errorcode){ +void Errhandler::call(MPI_File file, int errorcode) const +{ file_func_(&file, &errorcode); } @@ -43,11 +43,15 @@ void Errhandler::ref() } void Errhandler::unref(Errhandler* errhandler){ + if(errhandler == MPI_ERRORS_ARE_FATAL || errhandler == MPI_ERRORS_RETURN) + return; errhandler->refcount_--; if(errhandler->refcount_==0){ + F2C::free_f(errhandler->f2c_id()); delete errhandler; } } } + }