Actual source code: psleep.c

      1: #define PETSC_DLL

     3:  #include petsc.h
      4: #if defined (PETSC_HAVE_UNISTD_H)
      5: #include <unistd.h>
      6: #endif
      7: #if defined (PETSC_HAVE_STDLIB_H)
      8: #include <stdlib.h>
      9: #endif
     10: #if defined (PETSC_HAVE_DOS_H)   /* borland */
     11: #include <dos.h>
     12: #endif
     13: #include "petscfix.h"

     17: /*@
     18:    PetscSleep - Sleeps some number of seconds.

     20:    Not Collective

     22:    Input Parameters:
     23: .  s - number of seconds to sleep

     25:    Notes:
     26:       If s is negative waits for keyboard input

     28:    Level: intermediate

     30:    Concepts: sleeping
     31:    Concepts: pause
     32:    Concepts: waiting

     34: @*/
     35: PetscErrorCode PETSC_DLLEXPORT PetscSleep(int s)
     36: {
     38:   if (s < 0) getc(stdin);
     39: #if defined (PETSC_HAVE_SLEEP)
     40:   else       sleep(s);
     41: #elif defined (PETSC_HAVE__SLEEP) && defined(PETSC_HAVE__SLEEP_MILISEC)
     42:   else       _sleep(s*1000);
     43: #elif defined (PETSC_HAVE__SLEEP)
     44:   else       _sleep(s);
     45: #else
     46:   #error No sleep function located!
     47: #endif
     48:   return(0);
     49: }