Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Dec 2008 22:09:50 +1100
From:      Andrew MacIntyre <andymac@bullseye.apana.org.au>
To:        Josh Paetzel <jpaetzel@FreeBSD.org>
Cc:        freebsd-python@FreeBSD.org
Subject:   Re: A FreeBSD specific patch to python 2.5.2
Message-ID:  <493FA37E.2050502@bullseye.andymac.org>
In-Reply-To: <493ECB1E.2050709@FreeBSD.org>
References:  <493ECB1E.2050709@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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