This source file includes following definitions.
- MPI_Win_set_errhandler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "ompi_config.h"
25 #include <stdio.h>
26
27 #include "ompi/mpi/c/bindings.h"
28 #include "ompi/runtime/params.h"
29 #include "ompi/communicator/communicator.h"
30 #include "ompi/errhandler/errhandler.h"
31 #include "ompi/win/win.h"
32
33 #if OMPI_BUILD_MPI_PROFILING
34 #if OPAL_HAVE_WEAK_SYMBOLS
35 #pragma weak MPI_Win_set_errhandler = PMPI_Win_set_errhandler
36 #endif
37 #define MPI_Win_set_errhandler PMPI_Win_set_errhandler
38 #endif
39
40 static const char FUNC_NAME[] = "MPI_Win_set_errhandler";
41
42
43 int MPI_Win_set_errhandler(MPI_Win win, MPI_Errhandler errhandler)
44 {
45 MPI_Errhandler tmp;
46
47 OPAL_CR_NOOP_PROGRESS();
48
49 if (MPI_PARAM_CHECK) {
50 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
51
52 if (ompi_win_invalid(win)) {
53 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_WIN,
54 FUNC_NAME);
55 } else if (NULL == errhandler ||
56 MPI_ERRHANDLER_NULL == errhandler ||
57 (OMPI_ERRHANDLER_TYPE_WIN != errhandler->eh_mpi_object_type &&
58 OMPI_ERRHANDLER_TYPE_PREDEFINED != errhandler->eh_mpi_object_type) ) {
59 return OMPI_ERRHANDLER_INVOKE(win, MPI_ERR_ARG, FUNC_NAME);
60 }
61 }
62
63
64 OBJ_RETAIN(errhandler);
65
66 OPAL_THREAD_LOCK(&win->w_lock);
67
68 tmp = win->error_handler;
69 win->error_handler = errhandler;
70 OBJ_RELEASE(tmp);
71 OPAL_THREAD_UNLOCK(&win->w_lock);
72
73
74 return MPI_SUCCESS;
75 }