From owner-freebsd-threads@FreeBSD.ORG Thu Jun 8 18:15:47 2006 Return-Path: X-Original-To: threads@freebsd.org Delivered-To: freebsd-threads@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B475116B20A for ; Thu, 8 Jun 2006 16:18:34 +0000 (UTC) (envelope-from mi+mx@aldan.algebra.com) Received: from aldan.algebra.com (aldan.algebra.com [216.254.65.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4467F43D5D for ; Thu, 8 Jun 2006 16:18:32 +0000 (GMT) (envelope-from mi+mx@aldan.algebra.com) Received: from corbulon.video-collage.com (static-151-204-231-237.bos.east.verizon.net [151.204.231.237]) by aldan.algebra.com (8.13.6/8.13.6) with ESMTP id k58GIS8H032244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 Jun 2006 12:18:29 -0400 (EDT) (envelope-from mi+mx@aldan.algebra.com) Received: from [172.21.130.86] (mx-broadway [38.98.68.18]) by corbulon.video-collage.com (8.13.6/8.13.6) with ESMTP id k58GIM1v030550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Jun 2006 12:18:23 -0400 (EDT) (envelope-from mi+mx@aldan.algebra.com) From: Mikhail Teterin Organization: Virtual Estates, Inc. To: Maxim Konovalov Date: Thu, 8 Jun 2006 12:18:16 -0400 User-Agent: KMail/1.9.1 References: <200606071906.25776.mi+mx@aldan.algebra.com> <200606071916.38538.mi+mx@aldan.algebra.com> <20060608081626.X6097@mp2.macomnet.net> In-Reply-To: <20060608081626.X6097@mp2.macomnet.net> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200606081218.17131.mi+mx@aldan.algebra.com> X-Virus-Scanned: ClamAV 0.88/1520/Wed Jun 7 17:47:18 2006 on corbulon.video-collage.com X-Virus-Status: Clean X-Scanned-By: MIMEDefang 2.43 Cc: threads@freebsd.org Subject: Re: SIGINFO and pthreads X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jun 2006 18:15:48 -0000 ÞÅÔ×ÅÒ 08 ÞÅÒ×ÅÎØ 2006 00:17, Maxim Konovalov ÎÁÐÉÓÁ×: > Inline it if it's small. šMailman strips most attachments. Damn... Yes, it is small -- this is just a demo program. Compile it first as cc -o t t.c Then -- run and try various keyboard signals like Ctrl-C, Ctrl-Z, Ctrl-T (SIGINFO), or Ctrl-\. (It will not quit on its own, you'll have to kill it from another prompt.) They will all work. Then -- recompile as cc -o t -pthread t.c And run... This time around it will ignore the Ctrl-T, while continuing to respond to others. > libpthread uses SIGINFO for dumping thread information to a file but > looking over the code it seems it does allow to use SIGINFO to the > app. I'd like to be able to disable the debugging feature or, at least, force it to call my signal-handler AS EXPECTED AND DOCUMENTED, after it is done with its own dumping. -mi #include #include #include #include static void sigfunc(int signum) { printf("Received signal %d\n", signum); } int main(int argc, char *argv[]) { int i; for (i = 1; i < 32; i++) if (signal(i, sigfunc) == SIG_ERR) /* KILL and STOP */ warn("Trying to handle %d failed", i); for (;;) sleep(1000); return 0; }