xref: /petsc/src/sys/utils/psleep.c (revision e5c89e4ece6e3231999e6896bd6dacaf81d4b32f)
1 #define PETSC_DLL
2 
3 #include "petsc.h"                 /*I   "petsc.h"    I*/
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"
14 
15 #undef __FUNCT__
16 #define __FUNCT__ "PetscSleep"
17 /*@
18    PetscSleep - Sleeps some number of seconds.
19 
20    Not Collective
21 
22    Input Parameters:
23 .  s - number of seconds to sleep
24 
25    Notes:
26       If s is negative waits for keyboard input
27 
28    Level: intermediate
29 
30    Concepts: sleeping
31    Concepts: pause
32    Concepts: waiting
33 
34 @*/
35 PetscErrorCode PETSC_DLLEXPORT PetscSleep(int s)
36 {
37   PetscFunctionBegin;
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   PetscFunctionReturn(0);
49 }
50 
51