int pid, status, ret;
int filedes[2];
rc = pipe(filedes);
pid = fork();
if (pid == 0) {
ret=0;
close(filedes[0]);
rc = functionThatMatters(/* some args */);
if (!rc) {
ret = 0;
} else {
ret = 1;
}
close(filedes[1]);
exit(ret);
} else {
close(filedes[1]);
close(filedes[0]);
rc = timewait(pid, &status, /* timeout values */);
rc = WEXITSTATUS(status);
}
if (!rc) {
(*outStatus)[i] = 1;
/* LOG WARNING THAT WE HAVE FAILED */
} else {
(*outStatus)[i] = 0;
}
This reminds me forgotten stories about Miklos...
No comments:
Post a Comment