Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Dec 1998 19:22:45 -0800 (PST)
From:      eischen@vigrid.com
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   bin/9162: [Patch] pthreads GC breaks signal handling
Message-ID:  <199812220322.TAA11475@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         9162
>Category:       bin
>Synopsis:       [Patch] pthreads GC breaks signal handling
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 21 19:30:01 PST 1998
>Last-Modified:
>Originator:     Daniel Eischen
>Organization:
>Release:        2.2.8-stable and 3.0-current
>Environment:
FreeBSD klr.clc.gdeb.com 2.2.7-STABLE FreeBSD 2.2.7-STABLE #0: Thu Oct 22 18:12:35 EDT 1998     deischen@klr.clc.gdeb.com:/opt/b/src/src/sys/compile/klr  i386
>Description:
If a threaded program installs a handler for a signal, and this program
receives that signal, then the signal handler is invoked for the garbage
collector thread.  The GC thread should be transparent to the application
and no signal handlers should be called as a result of it being present.
>How-To-Repeat:
Build and run libc_r/uthread/test/sigwait/sigwait.c (these tests
are there for a reason, no? ;-))
>Fix:
One fix is to block all signals in the garbage collector thread.
Here is a patch:

*** uthread_gc.c.orig	Mon Dec 21 22:08:54 1998
--- uthread_gc.c	Mon Dec 21 22:11:34 1998
***************
*** 47,52 ****
--- 47,53 ----
  	int		f_debug;
  	int		f_done = 0;
  	int		ret;
+ 	sigset_t	mask;
  	pthread_t	pthread;
  	pthread_t	pthread_cln;
  	pthread_t	pthread_nxt;
***************
*** 59,64 ****
--- 60,69 ----
  
  	/* Set the name of this thread. */
  	pthread_set_name_np(_thread_run,"GC");
+ 
+ 	/* Block all signals. */
+ 	sigfillset(&mask);
+ 	sigprocmask(SIG_BLOCK, &mask, NULL);
  
  	while (!f_done) {
  		/* Check if debugging this application. */

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812220322.TAA11475>