mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* fork and sigprocmask as an atomic operation?
@ 2011-05-13  4:48 Till Varoquaux
  0 siblings, 0 replies; only message in thread
From: Till Varoquaux @ 2011-05-13  4:48 UTC (permalink / raw)
  To: linux-kernel

If I understand properly the idiomatic way to set the signal mask in a
forked of process is to block all signals in the parent process before
calling fork and then setting the desired mask in both processes.

sigprocmask()
.....        <-- All the signals are going to be put in the pending list
clone ()
......
sigprocmask() <-- release all the pending signals that we care about.

Now; unless I am missing something this does not seem to play well
with threads. Providing several threads go through that exact dance at
the same time it seems as  could this result in the application ending
up with the wrong signal mask?

Is there any good reason to not add a new flag  to clone that would
block all signals in the child process?

Cheers,
Til

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-13  4:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-13  4:48 fork and sigprocmask as an atomic operation? Till Varoquaux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®