There is a problem in the fork script I am writing.
The below mentioned code pseudocode fails to process properly and uses
the partially processed data from the first forked child.
Pseudocode always fails to process properly. That is why we program in
Perl, rather than psuedocode. You should try it sometime.
if(pid1 = fork()) {
process something..
waitpid (pid1, 1)
A nonblocking waitpid in which you don't check the return
value--Why bother doing it in the first place?
....
where as the below mentioned code works perfectly.
The below mentioned code doesn't even have balanced curlies.
Can someone please help me identify the reson why the first code piece
is failing?
If you post real code, I very well might be able to. You could replace
"process something" with a very simple scalar increment or array push or
pop, to properly demonstrate the problem. (And if you can't, then the
problem probably lies within "process something" rather than in the parts
you showed us.)
Xho