M
michael
Hi All,
I have the following:
#define MAX_SLEEP_TIME 1000
#include <unistd.h>
void do_sleep(){
unsigned int random;
while(TRUE){
srand(time(NULL)%getpid());
random = rand()%MAX_SLEEP_TIME;
if(random != 0) break;
}
usleep(random);
}
when I compile I get a warning that says "implicit declaration of usleep". I
thought usleep was declared in <unistd.h>
What have I got wrong and how can I fix it?
Thanks for your help
Michael
I have the following:
#define MAX_SLEEP_TIME 1000
#include <unistd.h>
void do_sleep(){
unsigned int random;
while(TRUE){
srand(time(NULL)%getpid());
random = rand()%MAX_SLEEP_TIME;
if(random != 0) break;
}
usleep(random);
}
when I compile I get a warning that says "implicit declaration of usleep". I
thought usleep was declared in <unistd.h>
What have I got wrong and how can I fix it?
Thanks for your help
Michael