1: /*$Id: ex2.c,v 1.19 2001/08/07 21:29:12 bsmith Exp $*/
3: /*
4: Tests the signal handler.
5: */
6: #include petsc.h
10: int CreateError(int n)
11: {
12: int ierr;
13: PetscReal *x = 0;
14: if (!n) x[0] = 100.;
15: CreateError(n-1);
16: return 0;
17: }
21: int main(int argc,char **argv)
22: {
24: PetscInitialize(&argc,&argv,(char *)0,0);
25: PetscFPrintf(PETSC_COMM_WORLD,stdout,"Demonstrates how PETSc can trap error interrupts\n");
26: PetscFPrintf(PETSC_COMM_WORLD,stdout,"The error below is contrived to test the code!\n");
27: PetscSynchronizedFlush(PETSC_COMM_WORLD);
28: CreateError(5);
29: PetscFinalize();
30: return 0;
31: }
32: