2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
14 * Additional copyrights may follow
18 #include "ompi_config.h"
21 #include "ompi/mpi/c/bindings.h"
22 #include "ompi/win/win.h"
23 #include "ompi/mca/osc/osc.h"
25 #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
26 #pragma weak MPI_Win_unlock = PMPI_Win_unlock
29 #if OMPI_PROFILING_DEFINES
30 #include "ompi/mpi/c/profile/defines.h"
33 static const char FUNC_NAME
[] = "MPI_Win_unlock";
36 int MPI_Win_unlock(int rank
, MPI_Win win
)
40 if (MPI_PARAM_CHECK
) {
41 OMPI_ERR_INIT_FINALIZE(FUNC_NAME
);
43 if (ompi_win_invalid(win
)) {
44 return OMPI_ERRHANDLER_INVOKE(win
, MPI_ERR_WIN
, FUNC_NAME
);
45 } else if (ompi_win_peer_invalid(win
, rank
)) {
46 return OMPI_ERRHANDLER_INVOKE(win
, MPI_ERR_RANK
, FUNC_NAME
);
47 } else if (0 == (ompi_win_get_mode(win
) & OMPI_WIN_LOCK_ACCESS
)) {
48 return OMPI_ERRHANDLER_INVOKE(win
, MPI_ERR_RMA_SYNC
, FUNC_NAME
);
52 rc
= win
->w_osc_module
->osc_unlock(rank
, win
);
53 OMPI_ERRHANDLER_RETURN(rc
, win
, rc
, FUNC_NAME
);