Subject: -current and libpthread and signals
To: None <current-users@NetBSD.org>
From: Stephan Thesing <thesing@cs.uni-sb.de>
List: current-users
Date: 05/06/2004 23:29:35
Hi,

I noticed that signal delivery has problems with a Qt application that uses the
QProcess class and thus creates and destroys threads and receives SIGCHLD when
a child _process_ has exited (internally in Qt the QProcess class installs a
signal handler for SIGCHLD and from the handler triggers the Qt notification
mechanism).

The symptoms are either
 - the signal is never delivered to a thread, as all living threads have it
   blocked in their signal masks
or
 - with PTHREAD_CONCURRENCY=2, an assertion in libpthreads triggers when a
   signal is tried to be delivered to a running thread:
   assertion "target->pt_state != PT_STATE_RUNNING || target->pt_blockgen !=
   target->pt_unblockgen" failed: file "/usr/src/lib/libpthread/pthread_sig.c",
   line 794, function "pthread__kill"

[ The first case may be because at the time the signal is delivered, it is
  blocked in all but one thread. Unfortunately, the thread that has the signal
  pending, exits before the signal handler can be taken. As the signal remains
  blocked in all other threads, the handler is never invoked.
  (Which is just my impression after ooking at some debug output of libpthread,
  without pretending I understand the code and interna of the pthread library)
]

I am just curious if this behavior is known and on somebodys TODO list....

If more input is needed to fix this behavior I can try to construct a smaller
example program that triggers it (the original application is quite large and
propietary source code..)....

Best regards....
	Stephan


=  Tel.: +49-681-302-5571      = Universitaet des Saarlandes =
=  Fax.: +49-681-302-3065      = Postfach 15 11 50           =
=  Compiler Research Group     = 66041 Saarbruecken          =
=  FR 6.2 - Informatik         = GERMANY                     =