[OpenAFS-devel] pthreading the bosserver

Chas Williams (CONTRACTOR) chas@cmf.nrl.navy.mil
Thu, 08 Aug 2013 18:40:46 -0400


In message <alpine.GSO.1.10.1308081518210.24720@multics.mit.edu>,Benjamin Kaduk writes:
>gerrit/6947 raises some potentially large spectres, in particular 
>LinuxThreads compatibility.  Chas has dedicated pthreads for each child 
>process to listen for SIGCHLD, plus a global thread for SIGTERM/SIGQUIT 

Not quite.  In the threaded version, each thread calls waitpid() after
spawning the child process.  So signals are only handled in a single
thread which is much easier to deal with.  I did it this way to work
around the way LinuxThread behaves (SIGCHLD wouldn't necessarily go to
the thread listening for signals) but overall this is actually quite a
bit cleaner than having a single "thread" that needs to poll the status
of each child.

It the lwp version of the code wasn't necessary, the #ifdef maze could
be cleaned up a bit.