A FreeBSD specific patch to python 2.5.2

Josh Paetzel jpaetzel at FreeBSD.org
Tue Dec 9 12:05:50 PST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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


Comments welcome.

- --
Thanks,

Josh Paetzel

PGP: 8A48 EF36 5E9F 4EDA 5ABC 11B4 26F9 01F1 27AF AECB
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkk+yx4ACgkQJvkB8SevrssKOwCePaopeUdg6HJCnAZ5u67EfLAN
7XwAnjew2HxCvCmHHjrKrdXGTLSx2GmH
=OLJc
-----END PGP SIGNATURE-----


More information about the freebsd-python mailing list