Subject: Re: -current and libpthread and signals
To: Stephan Thesing <>
From: Bill Studenmund <>
List: current-users
Date: 05/10/2004 15:37:10
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, May 06, 2004 at 11:29:35PM +0200, Stephan Thesing wrote:
> Hi,
> I noticed that signal delivery has problems with a Qt application that us=
es the
> QProcess class and thus creates and destroys threads and receives SIGCHLD=
> a child _process_ has exited (internally in Qt the QProcess class install=
s a
> signal handler for SIGCHLD and from the handler triggers the Qt notificat=
> mechanism).
> The symptoms are either
>  - the signal is never delivered to a thread, as all living threads have =
>    blocked in their signal masks
> or
>  - with PTHREAD_CONCURRENCY=3D2, an assertion in libpthreads triggers whe=
n a
>    signal is tried to be delivered to a running thread:
>    assertion "target->pt_state !=3D PT_STATE_RUNNING || target->pt_blockg=
en !=3D
>    target->pt_unblockgen" failed: file "/usr/src/lib/libpthread/pthread_s=
>    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 s=
>   pending, exits before the signal handler can be taken. As the signal re=
>   blocked in all other threads, the handler is never invoked.
>   (Which is just my impression after ooking at some debug output of libpt=
>   without pretending I understand the code and interna of the pthread lib=
> ]

This issue, if correct, seems like a library bug. If you are going to ask=
for SIGCHLD, you should have something to receive it.

I'm not sure what the right behavior is if you get a signal (that you=20
requested) and nothing can receive it.

> 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 sma=
> example program that triggers it (the original application is quite large=
> propietary source code..)....

Unfortunately I am not a person to work on this. However if you could make=
a simpler test, that would be great. It could even be added as a=20
regression test.

Take care,


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.3 (NetBSD)