Changeset 915


Ignore:
Timestamp:
03/15/12 14:35:08 (12 years ago)
Author:
nanardon
Message:
  • revert race condition fix, seems it does not solve anything
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/bin/la-sync-manager

    r897 r915  
    7979    my $pid = fork; 
    8080    if ($pid == 0) { 
    81         local $SIG{HUP} = 'IGNORE'; 
    8281        $SIG{INT} = 'DEFAULT'; 
    8382        my $res = $syncm->process_module($module, $baserev); 
    8483        exit($res ? 0 : 1); 
    8584    } 
    86     my $done = 0; 
    87     my $res = 0; 
    88     local $SIG{CHLD} = sub { 
    89         my $retpid = waitpid($pid, 0); 
    90         if ($retpid < 0) { 
    91             # no such process ?? 
    92         } elsif ($retpid) { 
    93             $res = $? >> 8; 
    94             if ($res) { 
    95                 la_log LA_ERR, "Sync process exit with $res"; 
    96             } 
     85    my $retpid; 
     86    while(($retpid = waitpid(-1, 0)) <= 0) {} 
     87    local $SIG{HUP} = 'IGNORE'; 
     88    if ($retpid) { 
     89        my $res = $? >> 8; 
     90        if ($res) { 
     91            la_log LA_ERR, "Sync process exit with $res"; 
     92            return; 
    9793        } 
    98         $done = 1; 
    99     }; 
    100     while (!$done) { 
    101         sleep(1); 
    10294    } 
    103     return !$res; 
     95    return 1; 
    10496} 
    10597 
Note: See TracChangeset for help on using the changeset viewer.