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 Keyval_free 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) {
16 MPI_Keyval_free(&keyval);
20 int main (int argc, char **argv)
23 int keyval = MPI_KEYVAL_INVALID;
24 int keyval_copy = MPI_KEYVAL_INVALID;
27 MTest_Init( &argc, &argv );
28 MPI_Comm_dup(MPI_COMM_SELF, &duped);
30 MPI_Keyval_create(MPI_NULL_COPY_FN, delete_fn, &keyval, NULL);
33 MPI_Attr_put(MPI_COMM_SELF, keyval, NULL);
34 MPI_Attr_put(duped, keyval, NULL);
36 MPI_Comm_free(&duped); /* first MPI_Keyval_free */
37 MPI_Keyval_free(&keyval); /* second MPI_Keyval_free */
38 MPI_Keyval_free(&keyval_copy); /* third MPI_Keyval_free */
39 MTest_Finalize( errs );
40 MPI_Finalize(); /* fourth MPI_Keyval_free */