Unix Programming - Does calling wait() poll?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > July 2007 > Does calling wait() poll?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Does calling wait() poll?
K-mart Cashier

2007-07-14, 1:26 am

Say I have a program that calls this function every 2 seconds

static int
tel(char *user, char *tty, const char *what)
{
pid_t cpid, wpid;
int stats;

cpid = fork();
if (cpid < 0) {
err("fork failed:", cpid);
}
if((execlp("tel", "tel", user, tty, what, (char *)0)) < 0)
perror("execlp tel failed\n");
_exit(EXIT_FAILURE);
}


while ((wpid= wait(&stats)) != cpid && wpid != -1)
;

return (WIFEXITED(stats) ? WEXITSTATUS(stats) : -2);
}


would calling wait() every 2 seconds, would I be 'polling'?

Chad

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com