It's been rumoured that Randy Locklair said:
> 
> Ok.. more on that pthreads and signals issue..

I assume you've discovered the pthread_sigmask and sigwait routines.
That might help you some.

> My process starts up one extra thread.  Once its done that it has three
> pid's.  If i kill -9 the last one in the tree, the process dies.  If I
> kill -9 the first one, the process dies.  If i kill -9 the middle one, it
> goes defunct, but both threads seem to continue.  Wierd.
> 
> Also, I can't ctrl-c or ctrl-\ the process.  I am assuming that ignoring all
> signals might solve that problem.  I will keep tinkering, I just am posting
> in case anyone has any hints ;)

Part of me says these are linux kernel bugs. Another part of me says
'don't do that'.  Any code you write here is likely to be highly
non-portable.  Different unixes tend to have very different semantics
for these things.  What works on Linux might not work on AIX, and v.v.
Sometimes everything does indeed 'work correctly', but its highly
non-intuitive what 'work correctly' meant.

e.g. was the thread blocked when signal delivered? Was it blocked in 
select() or read(), or was it blocked in pthread_join()?  Was the thread 
created detached or not?  My experience is that 'detached' tends to
cause a lot of pain and non-intuitive behaviour.  If your threads have
mutex locks (which I'm sure they do), and you are not using them exactly
correctly, the delivery of signals can seem wierd.   Draw a diagram
showing every possible  combination of thread lock, blocking, condwait
release and signal arrival, and you'll see what I mean.   It can get
nasty real fast.

--linas

> 
> Randy
> 

Reply via email to