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

254 Views Asked by At

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.

1

There are 1 best solutions below

2
On BEST ANSWER

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 (500). You also need to include the header #include<cextdecs(DELAY)>