John Levon wrote:

> On Wed, Mar 24, 2004 at 10:55:11AM +0000, Angus Leeming wrote:
> 
>> 1       if (current_child == -1)
>> 2           return;
>> 
>>         // Block the SIGCHLD signal.
>> 3       sigprocmask(SIG_BLOCK, &newMask, &oldMask);
>> 
>>         // Wait for an existing signal to finish being processed.
>> 4       while (child_guard) {}
> 
> Signals are asynchronous, but they're not parallel. Your code won't
> simultaneously be executing this while() loop *and* executing signal
> code, it'll be one or the other. So child_guard can't possibly be
> set here.

Great! However...

I thought that I read that the handler could be implemented as a 
separate thread? If this is true, then SMP machines will execute it 
in parallel, no?

Incidentally, shouldn't we handle WIFCONTINUED in 
handleCompletedProcesses()?

    } else if (WIFSTOPPED(store.status)) {
        lyxerr << "LyX: Child (pid: " << store.pid
               << ") stopped on signal "
               << WSTOPSIG(store.status)
               << ". Waiting for child to finish." << endl;
    } else if (WIFCONTINUED(store.status)) {
        lyxerr << "LyX: Child (pid: " << store.pid
               << ") that was stopped has been restarted." 
               << " Waiting for child to finish." << endl;
    } else {
        lyxerr << "LyX: Something rotten happened while "
                  "waiting for child " << store.pid << endl;

        // Child died, so pretend it returned 1
        child.setRetValue(1);
        remove_it = true;
    }
 
 

-- 
Angus

Reply via email to