1
1
openmpi/ompi/mpi/cxx/file.cc
Brian Barrett 1ba97181dc A number of MPI-2 compliance fixes for the C++ bindings:
* Added Create_errhandler for MPI::File
  * Make errors_throw_exceptions a first-class predefined exception
    handler, and make it work for Comm, File, and Win
  * Deal with error handlers and attributes for Files, Types, and Wins
    like we do with Comms - can't just cast the callbacks from C++
    signatures to C signatures.  Callbacks will then fire with the
    C object, not the C++ object.  That's bad.

Refs trac:455

This commit was SVN r12945.

The following Trac tickets were found above:
  Ticket 455 --> https://svn.open-mpi.org/trac/ompi/ticket/455
2006-12-30 23:41:42 +00:00

39 строки
904 B
C++

// -*- c++ -*-
//
// Copyright (c) 2006 Los Alamos National Security, LLC. All rights
// reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
//
// $HEADER$
//
// do not include ompi_config.h because it kills the free/malloc defines
#include "mpi.h"
#include "ompi/mpi/cxx/mpicxx.h"
#include "opal/threads/mutex.h"
void
MPI::File::Close()
{
MPI_File save = mpi_file;
(void) MPI_File_close(&mpi_file);
OPAL_THREAD_LOCK(MPI::mpi_map_mutex);
MPI::File::mpi_file_map.erase(save);
OPAL_THREAD_UNLOCK(MPI::mpi_map_mutex);
}
void
MPI::File::Set_errhandler(const MPI::Errhandler& errhandler)
{
my_errhandler = (MPI::Errhandler *)&errhandler;
OPAL_THREAD_LOCK(MPI::mpi_map_mutex);
MPI::File::mpi_file_map[mpi_file] = this;
OPAL_THREAD_UNLOCK(MPI::mpi_map_mutex);
(void)MPI_File_set_errhandler(mpi_file, errhandler);
}