From owner-freebsd-amd64@FreeBSD.ORG Fri Jun 11 08:55:47 2004 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E87916A4CE for ; Fri, 11 Jun 2004 08:55:47 +0000 (GMT) Received: from mail.mcneil.com (rrcs-west-24-199-45-54.biz.rr.com [24.199.45.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2646B43D55 for ; Fri, 11 Jun 2004 08:55:47 +0000 (GMT) (envelope-from sean@mcneil.com) Received: from localhost (localhost.mcneil.com [127.0.0.1]) by mail.mcneil.com (Postfix) with ESMTP id B363AFD087; Fri, 11 Jun 2004 01:55:18 -0700 (PDT) Received: from mail.mcneil.com ([127.0.0.1]) by localhost (server.mcneil.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 28084-09; Fri, 11 Jun 2004 01:55:17 -0700 (PDT) Received: from [24.199.45.54] (mcneil.com [24.199.45.54]) by mail.mcneil.com (Postfix) with ESMTP id 622F2FD012; Fri, 11 Jun 2004 01:55:17 -0700 (PDT) From: Sean McNeil To: Daniel Eischen In-Reply-To: References: Content-Type: text/plain Message-Id: <1086944114.76446.5.camel@server.mcneil.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Fri, 11 Jun 2004 01:55:14 -0700 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mcneil.com cc: freebsd-amd64@freebsd.org Subject: Re: signal handler priority issue X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jun 2004 08:55:47 -0000 (I've cc'd the amd64 list so here is some background) I'm experiencing some odd behavior with signals and threads. Daniel has managed to isolate it to an example program that works. Except.... OK, so maybe this is an optimization bug. The following works fine with no optimization, but with -O or -O2 it fails on an amd64. Can someone test with various optimizations on i386? Compiled with cc -o test_sr test_sr.c -pthread works cc -O -o test_sr test_sr.c -pthread or cc -O2 -o test_sr test_sr.c -pthread hangs /* * test_sr.c * * Demonstrate use of signals & semaphores for suspending and * resuming threads. */ #include #include #include #include #include #include #include #include #ifndef NUM_THREADS #define NUM_THREADS 5 #endif static sem_t semaphore; static int done = 0; static pthread_t tids[NUM_THREADS]; static void errno_abort(char *msg) { printf("%s, errno %d\n", msg, errno); abort(); } static void err_abort(int status, char *msg) { printf("%s, status %d\n", msg, status); abort(); } static void sighandler1(int sig, siginfo_t *info, ucontext_t *ucp) { sigset_t mask; int i; pthread_t self = pthread_self(); for (i=0; i