1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2009 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
12 /* tests multiple invocations of MPI_Comm_free_keyval on the same keyval */
14 int delete_fn(MPI_Comm comm, int keyval, void *attr, void *extra);
15 int delete_fn(MPI_Comm comm, int keyval, void *attr, void *extra)
17 MPI_Comm_free_keyval(&keyval);
21 int main(int argc, char **argv)
24 int keyval = MPI_KEYVAL_INVALID;
25 int keyval_copy = MPI_KEYVAL_INVALID;
28 MTest_Init(&argc, &argv);
29 MPI_Comm_dup(MPI_COMM_SELF, &duped);
31 MPI_Comm_create_keyval(MPI_NULL_COPY_FN, delete_fn, &keyval, NULL);
34 MPI_Comm_set_attr(MPI_COMM_SELF, keyval, NULL);
35 MPI_Comm_set_attr(duped, keyval, NULL);
37 MPI_Comm_free(&duped); /* first MPI_Comm_free_keyval */
38 MPI_Comm_free_keyval(&keyval); /* second MPI_Comm_free_keyval */
39 MPI_Comm_free_keyval(&keyval_copy); /* third MPI_Comm_free_keyval */
41 MPI_Finalize(); /* fourth MPI_Comm_free_keyval */