From ag@ag-gw.muc.de Sun Oct 17 15:23:12 1999
Return-Path: <ag@ag-gw.muc.de>
Received: from ag-gw.muc.de (ag-gw.muc.de [193.149.48.126])
	by hub.freebsd.org (Postfix) with ESMTP id 4ACF514DFD
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 17 Oct 1999 15:23:07 -0700 (PDT)
	(envelope-from ag@ag-gw.muc.de)
Received: (from ag@localhost)
	by ag-gw.muc.de (8.9.3/8.9.2) id AAA66637;
	Mon, 18 Oct 1999 00:23:06 +0200 (CEST)
	(envelope-from ag)
Message-Id: <199910172223.AAA66637@ag-gw.muc.de>
Date: Mon, 18 Oct 1999 00:23:06 +0200 (CEST)
From: ag@muc.de
Sender: ag@ag-gw.muc.de
Reply-To: ag@muc.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: Probable bug in phtread_kill() (both RELENG_3 and CURRENT) ?
X-Send-Pr-Version: 3.2

>Number:         14383
>Category:       i386
>Synopsis:       pthread_kill() does not call sighandler of specific thread
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 17 15:30:01 PDT 1999
>Closed-Date:    Fri Dec 17 03:21:07 PST 1999
>Last-Modified:  Fri Dec 17 03:21:41 PST 1999
>Originator:     Armin Gruner
>Release:        FreeBSD 3.2-RELEASE i386
>Organization:
muc.de
>Environment:
		Standard 3.2 RELEASE installation 
		(sources upgraded to RELENG_3 AND CURRENT,
		 source of pthreads did not change there)

>Description:

		If using pthread_kill(), the signal handler is 
		not called, if the specific thread is e.g. sleep()ing.
		Only EINTR is returned.

>How-To-Repeat:

		Run /usr/src/lib/libc_r/test/sigsuspend.
		The test will fail because the signal handler does
		not get called that many times than expected.

>Fix:
(applies both to RELENG_3 and CURRENT)
		If the thread which should be signalled is in
		SLEEP_WAIT, SELECT_WAIT and similar states, *RECORD*
		the signal in the sigpending mask, as done in other
		states too:

Index: uthread_kill.c
===================================================================
RCS file: /usr/FreeBSD-CVS/src/lib/libc_r/uthread/uthread_kill.c,v
retrieving revision 1.5.2.3
diff -u -w -r1.5.2.3 uthread_kill.c
--- uthread_kill.c	1999/08/29 14:55:57	1.5.2.3
+++ uthread_kill.c	1999/10/17 21:19:08
@@ -109,11 +109,8 @@
 
 				/* Return the signal number: */
 				pthread->signo = sig;
-			} else {
-				/* Increment the pending signal count: */
-				sigaddset(&pthread->sigpend,sig);
 			}
-			break;
+			/* fallthrough */
 
 		default:
 			/* Increment the pending signal count: */

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: deischen 
State-Changed-When: Fri Dec 17 03:21:07 PST 1999 
State-Changed-Why:  
Fixed in -current. 
>Unformatted:
 		 if this thread is sleeping (thread is only getting EINTR)
 Class:           sw-bug
