6 void errfunc( MPI_Comm *, int *, ... );
8 void errfunc( MPI_Comm *, int * );
12 * Test the reference count semantics of error handlers.
14 int main( int argc, char *argv[] )
16 MPI_Errhandler errhandler, olderrhandler;
20 MPI_Init( &argc, &argv );
22 MPI_Comm_dup( MPI_COMM_WORLD, &newcomm );
23 MPI_Errhandler_create( errfunc, &errhandler );
24 MPI_Errhandler_set( newcomm, errhandler );
25 /* Once you set it, you should be able to free it */
26 MPI_Errhandler_free( &errhandler );
27 if (errhandler != MPI_ERRHANDLER_NULL) {
28 printf( "Freed errhandler is not set to NULL\n" );
31 MPI_Errhandler_get( newcomm, &olderrhandler );
32 MPI_Comm_free( &newcomm );
34 /* olderrhandler should now be invalid. Is it? */
35 /* This test is based on an interpretation of the MPI standard that
36 was subsequently overturned. See the MPI-1.1 errata.
37 An Errhandler_get is similar to an MPI_Comm_group (having the
38 effect of creating a copy to the object). */
39 MPI_Errhandler_set( MPI_COMM_WORLD, MPI_ERRORS_RETURN );
40 rc = MPI_Errhandler_set( MPI_COMM_WORLD, olderrhandler );
41 /* In the old interpretation, the test is !rc */
43 printf( "Olderrhandler invalid after get and comm freed!\n" );
48 printf( "Found %d errors!\n", errcnt );
50 printf( " No Errors\n" );
56 #if defined(USE_STDARG)
57 void errfunc( MPI_Comm *comm, int *err, ...)
59 void errfunc( MPI_Comm *comm, int *err)