[ovs-dev] [threads 04/17] process: Make signal handling thread-safe.

Ben Pfaff blp at nicira.com
Mon Jun 10 17:59:21 UTC 2013


On Thu, Jun 06, 2013 at 05:34:26PM -0700, Alex Wang wrote:
> On Thu, Jun 6, 2013 at 4:27 PM, Ben Pfaff <blp at nicira.com> wrote:
> 
> > On Thu, Jun 06, 2013 at 09:49:11AM -0700, Alex Wang wrote:
> > > The 2/17. 3/17 look good to me.
> >
> > > For this patch, want to ask few questions:
> > >
> > > 1. why does the previous implementation cannot guarantee thread safety
> > (An
> > > example?)? Is this related to the sigchld_ related functions?
> >
> > A single-threaded process can ensure that a signal handler doesn't
> > run during a section of code by blocking and unblocking the signal
> > around that section of code.  A multithreaded process can't do that,
> > because the signal handler might get invoked from any thread.
> 
> Seem to me that we make a rule here. We only want single threaded process
> to call "process_init() and process_start()", right?

Yes, the later patch "Add thread safety comments" adds such comments.
> 
> Also, I want to ask why do you remove the sigchld_ related functions? Is
> that because the "xpthread_sigmask()" is not thread safe?

I removed them because, after the patch, they were no longer used.



More information about the dev mailing list