All of lore.kernel.org
 help / color / mirror / Atom feed
* fork and pthreads
@ 2001-03-16 16:34 Sane_Purushottam
  2001-03-16 17:23 ` Doug McNaught
  2001-03-16 17:52 ` Richard Guenther
  0 siblings, 2 replies; 6+ messages in thread
From: Sane_Purushottam @ 2001-03-16 16:34 UTC (permalink / raw)
  To: linux-kernel

I am having a strange problem.

I have a big daemon program to which I am trying to add multi-threading.

At the begining, after some sanity check, this program does a double fork to
create a deamon.

After that it listens for the client on the port. Whenever the client
connects, it creates a new thread using
pthread-create.

The problem is, the thread (main thread) calling pthread-create hangs
indefinetely in __sigsuspend. The newly created thread however, runs
normally to completion.

I wrote few test programs trying to simulate this behaviour but all of them
worked as expected.

Does anyone know, what's going on ??

Nitin Sane
sane_purushottam@emc.com
*(508)382-7319


^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: fork and pthreads
@ 2001-03-16 18:09 Sane, Purushottam
  2001-03-16 23:11 ` Laramie Leavitt
  0 siblings, 1 reply; 6+ messages in thread
From: Sane, Purushottam @ 2001-03-16 18:09 UTC (permalink / raw)
  To: 'Craig Ruff', Richard Guenther; +Cc: linux-kernel

I am not using any signals. All the signals are blocked with SIG_IGN

Nitin Sane
sane_purushottam@emc.com
*(508)382-7319


-----Original Message-----
From: Craig Ruff [mailto:cruff@ucar.edu]
Sent: Friday, March 16, 2001 1:03 PM
To: Richard Guenther
Cc: Sane_Purushottam@emc.com; linux-kernel@vger.kernel.org
Subject: Re: fork and pthreads


On Fri, Mar 16, 2001 at 06:52:26PM +0100, Richard Guenther wrote:
> Well, using pthreads and forking in them seems to trigger libc
> bugs (read: SIGSEGvs) here under certain conditions (happens,
> after I introduced signal handlers and using pthread_sigmask,
> I think), so hangs should be definitely possible, too...

You must pretty much avoid using signal handlers with pthreads.
In stead, you need to carefully setup things such that most signals
are blocked in most threads and a single thread (or selected set
of threads) does a sigwait for signals of interest.  Most good
pthreads books talk about this issue, as does the DCE documentation.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-03-16 23:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-16 16:34 fork and pthreads Sane_Purushottam
2001-03-16 17:23 ` Doug McNaught
2001-03-16 17:52 ` Richard Guenther
2001-03-16 18:03   ` Craig Ruff
  -- strict thread matches above, loose matches on Subject: below --
2001-03-16 18:09 Sane, Purushottam
2001-03-16 23:11 ` Laramie Leavitt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.