Home > database >  Sleep() function in C not working on hp non-stop
Sleep() function in C not working on hp non-stop

Time:09-26

I am trying something in C on hp-nonstop(tandem), As part my task is to wait for sometime.

I try to use the

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main()
{
   int i;
   for(i=0;i<10;i  )
   {
     printf("Something");
     sleep(5);
     printf("Something");
     fflush(stdout);
    }
 }

It's compiling without any problem,

While running it is giving ABENDED: each time different no.

CodePudding user response:

The result calling sleep() from guardian environment is undefined. That might be leading to ABEND that you mentioned. If you want to wait for some time in guardian hp-nonstop environment, you should call DELAY(). It takes centi-seconds as arguments. So if you want to add delay of 5 seconds, you should call it as DELAY (5). You also need to include the header #include<cextdecs(DELAY)>

  • Related