From owner-freebsd-python@FreeBSD.ORG Wed Dec 10 12:24:18 2008 Return-Path: Delivered-To: freebsd-python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B7A91065672; Wed, 10 Dec 2008 12:24:18 +0000 (UTC) (envelope-from andymac@bullseye.apana.org.au) Received: from ipmail01.adl6.internode.on.net (ipmail01.adl6.internode.on.net [203.16.214.146]) by mx1.freebsd.org (Postfix) with ESMTP id F3AB58FC27; Wed, 10 Dec 2008 12:24:17 +0000 (UTC) (envelope-from andymac@bullseye.apana.org.au) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsYEAEs+P0k7pybQ/2dsb2JhbACBbM5ngwc X-IronPort-AV: E=Sophos;i="4.33,746,1220193000"; d="scan'208";a="247352916" Received: from ppp59-167-38-208.lns2.cbr1.internode.on.net (HELO bullseye.apana.org.au) ([59.167.38.208]) by ipmail01.adl6.internode.on.net with ESMTP; 10 Dec 2008 22:39:02 +1030 Received: from [192.168.63.10] (tenring.andymac.org [192.168.63.10]) by bullseye.apana.org.au (8.14.2/8.14.2) with ESMTP id mBAC9hfx045399; Wed, 10 Dec 2008 23:09:43 +1100 (EST) (envelope-from andymac@bullseye.andymac.org) Message-ID: <493FA37E.2050502@bullseye.andymac.org> Date: Wed, 10 Dec 2008 22:09:50 +1100 From: Andrew MacIntyre User-Agent: Thunderbird 2.0.0.17 (OS/2/20080926) MIME-Version: 1.0 To: Josh Paetzel References: <493ECB1E.2050709@FreeBSD.org> In-Reply-To: <493ECB1E.2050709@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-python@FreeBSD.org Subject: Re: A FreeBSD specific patch to python 2.5.2 X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 12:24:18 -0000 Josh Paetzel wrote: > I work in a fairly python-centric environment, we use FreeBSD for all of > our production machines. > > Recently we have started using the following patch to python 2.5.2 in > production, and it's solved some issues we've had with regards to > python, FreeBSD, threads, and signals. > > I've been contemplating whether it should be included in the FreeBSD > port tree or not, and if it's included whether it should be optional, so > on and so forth. > > Here's the patch > > - --- Python/thread_pthread.h.orig 2006-06-13 15:04:24.000000000 > +0000 > +++ Python/thread_pthread.h 2008-11-11 07:20:33.000000000 +0000 > @@ -149,6 +149,7 @@ > { > pthread_t th; > int status; > + sigset_t set, oset; > #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) > pthread_attr_t attrs; > #endif > @@ -178,6 +179,8 @@ > pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM); > #endif > > + sigfillset(&set); > + SET_THREAD_SIGMASK(SIG_BLOCK, &set, &oset); > status = pthread_create(&th, > #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) > &attrs, > @@ -187,7 +190,7 @@ > (void* (*)(void *))func, > (void *)arg > ); > - - > + SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL); > #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) > pthread_attr_destroy(&attrs); > #endif Which versions of FreeBSD are you using this on? There are several FreeBSD thread related issues in the Python bug tracker and it would be useful to see if they can be squashed for the prospective 2.5.3 and 2.6.1 releases... -- ------------------------------------------------------------------------- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac@bullseye.apana.org.au (pref) | Snail: PO Box 370 andymac@pcug.org.au (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia