Process synchronization problem...

M

mchethan

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.

if(pid1 = fork()) {

process something..
 
X

xhoster

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top