From owner-freebsd-threads@FreeBSD.ORG Fri Apr 28 09:50:22 2006 Return-Path: X-Original-To: freebsd-threads@hub.freebsd.org Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BBE0716A401 for ; Fri, 28 Apr 2006 09:50:22 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 321E443D49 for ; Fri, 28 Apr 2006 09:50:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k3S9oL5T036628 for ; Fri, 28 Apr 2006 09:50:21 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k3S9oLSd036627; Fri, 28 Apr 2006 09:50:21 GMT (envelope-from gnats) Date: Fri, 28 Apr 2006 09:50:21 GMT Message-Id: <200604280950.k3S9oLSd036627@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: eugeny gladkih Cc: Subject: Re: threads/94176: KSE: sigwait doesn't recieve SIGWINCH sent by pthread_kill() or kill -WINCH X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: eugeny gladkih List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2006 09:50:22 -0000 The following reply was made to PR threads/94176; it has been noted by GNATS. From: eugeny gladkih To: David Xu Cc: Andriy Gapon , bug-followup@freebsd.org Subject: Re: threads/94176: KSE: sigwait doesn't recieve SIGWINCH sent by pthread_kill() or kill -WINCH Date: Fri, 28 Apr 2006 13:40:25 +0400 >>>>> "DX" == David Xu writes: AG> maybe it would be beneficial to the general programmer public to add AG> something similar to the NOTES section of the following man page to >> our AG> man page for sigwait: AG> http://condor.wesleyan.edu/cgi-bin/man.cgi?section=2&topic=sigwait >> AG> Using the original example, it would mean adding something like the AG> following code to get the desired behavior: >> AG> void dummy_handler(int signum) AG> { AG> return; AG> } >> AG> void *thread(void* unused) { AG> struct sigaction sa; AG> sa.sa_handler = dummy_handler; AG> sigemptyset(&sa.sa_mask); AG> sa.sa_flags = 0; AG> sigaction(SIGWINCH, &sa, NULL); AG> . AG> . AG> . >> >> >> why so stupid code should be presented in all software wanted >> just to wait the signal? :( >> >> sigwait'ed signal is not ignored one! we DON'T ignore it we DO >> wait for it. I'm afraid there is another problem with SIGTERM >> which will terminate process. am I right, yeah? DX> hmm, there is always race condition between userland and kernel, DX> guess what will happen if your thread is executing userland code and DX> a signal is being delivered to the process whose action is IGNORE ? DX> you are not waiting for the signal. DX> the dummy signal action you have to install can only help you to catch DX> bug if you forgot to mask it. in history, BSD throws aways signal DX> immediately if the signal action is IGNORE, otherwise an ignored signal DX> may cause a sleep to be interrupted, this can happen according to DX> current sleep queue code and signal code. well, Q&A department was wrong saying Solaris version works well. so, it's not FreeBSD problem, I can agree now. thanx, everybody! -- Yours sincerely, Eugeny. Doctor Web, Ltd. http://www.drweb.com