Process synchronization problem...

Discussion in 'Perl Misc' started by mchethan@gmail.com, Nov 8, 2005.

  1. Guest

    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..
     
    , Nov 8, 2005
    #1
    1. Advertising

  2. Guest

    wrote:
    > 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

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , Nov 8, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Francis
    Replies:
    1
    Views:
    665
    Ronald Hecht
    Apr 27, 2004
  2. Sami Lakka

    Synchronization Problem

    Sami Lakka, Dec 4, 2003, in forum: Java
    Replies:
    1
    Views:
    382
  3. Vincent Lascaux

    Thread synchronization problem

    Vincent Lascaux, Aug 31, 2004, in forum: Java
    Replies:
    9
    Views:
    419
    John C. Bollinger
    Sep 2, 2004
  4. Replies:
    2
    Views:
    377
    Thomas Hawtin
    Jul 14, 2006
  5. Gunter Henriksen
    Replies:
    13
    Views:
    1,733
    Lawrence D'Oliveiro
    May 1, 2009
Loading...

Share This Page