ape: improve setitimer
This commit is contained in:
parent
91d0343627
commit
2e05af858e
1 changed files with 3 additions and 3 deletions
|
@ -21,7 +21,7 @@ Timer timers[3] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
timerloop(Timer *timer, const struct timeval tval)
|
timerloop(int signal, const struct timeval tval)
|
||||||
{
|
{
|
||||||
pid_t ppid;
|
pid_t ppid;
|
||||||
struct timespec t, s;
|
struct timespec t, s;
|
||||||
|
@ -31,7 +31,7 @@ timerloop(Timer *timer, const struct timeval tval)
|
||||||
t.tv_nsec = tval.tv_usec*1000;
|
t.tv_nsec = tval.tv_usec*1000;
|
||||||
for(;;){
|
for(;;){
|
||||||
nanosleep(&t, &s);
|
nanosleep(&t, &s);
|
||||||
kill(ppid, timer->signal);
|
kill(ppid, signal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ setitimer(int which, const struct itimerval *new, struct itimerval *curr)
|
||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
return -1;
|
return -1;
|
||||||
case 0:
|
case 0:
|
||||||
timerloop(timer, new->it_interval);
|
timerloop(timer->signal, new->it_interval);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue