Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce the size of partial shared malloc tests.
[simgrid.git] / teshsuite / smpi / mpich3-test / rma / mcs-mutex.h
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *  (C) 2013 by Argonne National Laboratory.
4  *      See COPYRIGHT in top-level directory.
5  */
6
7 #if !defined MCSMUTEX_H_INCLUDED
8 #define MCSMUTEX_H_INCLUDED
9
10 #include <mpi.h>
11
12 #define MCS_MUTEX_TAG 100
13
14 #ifdef ENABLE_DEBUG
15 #define debug_print(...) do { printf(__VA_ARGS__); } while (0)
16 #else
17 #define debug_print(...)
18 #endif
19
20 struct mcs_mutex_s {
21     int tail_rank;
22     MPI_Comm comm;
23     MPI_Win window;
24     int *base;
25     MPI_Info win_info;
26 };
27
28 typedef struct mcs_mutex_s * MCS_Mutex;
29
30 #define MCS_MTX_ELEM_DISP 0
31 #define MCS_MTX_TAIL_DISP 1
32
33 int MCS_Mutex_create(int tail_rank, MPI_Comm comm, MCS_Mutex * hdl_out);
34 int MCS_Mutex_free(MCS_Mutex * hdl_ptr);
35 int MCS_Mutex_lock(MCS_Mutex hdl);
36 int MCS_Mutex_trylock(MCS_Mutex hdl, int *success);
37 int MCS_Mutex_unlock(MCS_Mutex hdl);
38
39 #endif /* MCSMUTEX_H_INCLUDED */