H
Huey
Hi All,
I encountered a funny thing, and my code schetch as below:
#define READ 0
#define WRITE 1
int byteRead, status, pd[2];
char buff[100];
pipe(pd);
if (fork()) {
wait(&status);
byteRead = read(pd[READ], buff, 100);
buff[byteRead] = '\0';
} else {
close(WRITE);
dup(pd[WRITE]);
execl("./c_executable", argv1, argv2, NULL);
}
This piece of code works very well for years for me. However, when my
c_executable got slightly heavier work load (a number of hash and
processing, and tesed thoroghly), it was broken. While I replaced
c_executable with lighter work load, it worked again. I am puzzled:
does the fork/wait pair has a timeout that terminates the child
process of execl()? If not, why a heavier work load in child process
failed? If yes, how to make the wait() to WAIT longer? If it is not
the issue of timeout, what is the kicker behind?
Thanks!
Huey
I encountered a funny thing, and my code schetch as below:
#define READ 0
#define WRITE 1
int byteRead, status, pd[2];
char buff[100];
pipe(pd);
if (fork()) {
wait(&status);
byteRead = read(pd[READ], buff, 100);
buff[byteRead] = '\0';
} else {
close(WRITE);
dup(pd[WRITE]);
execl("./c_executable", argv1, argv2, NULL);
}
This piece of code works very well for years for me. However, when my
c_executable got slightly heavier work load (a number of hash and
processing, and tesed thoroghly), it was broken. While I replaced
c_executable with lighter work load, it worked again. I am puzzled:
does the fork/wait pair has a timeout that terminates the child
process of execl()? If not, why a heavier work load in child process
failed? If yes, how to make the wait() to WAIT longer? If it is not
the issue of timeout, what is the kicker behind?
Thanks!
Huey