Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fac083d

Browse files
committed
Patch 775605: Cygwin pthread_sigmask() workaround patch
Cygwin's pthread_sigmask() implementation appears to be buggy. This patch works around this problem by using sigprocmask() instead. This patch is implemented in a general way so it could be used by other platforms too. If this approach is deemed too risky, then I can work up a patch that just hacks Python/thread_pthread.h for Cygwin. Note that I tested this patch against 2.3c1 under Red Hat Linux 8.0 too. [snip] And finally, I need someone to regenerate pyconfig.h.in and configure with the same versions of the autotools that are normally used by Python. Neal kindly regenerated pyconfig.h.in and configure for me.
1 parent 5d6ceb4 commit fac083d

4 files changed

Lines changed: 25 additions & 8 deletions

File tree

Python/thread_pthread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
* other UNIX International compliant systems that don't have the full
117117
* pthread implementation.
118118
*/
119-
#ifdef HAVE_PTHREAD_SIGMASK
119+
#if defined(HAVE_PTHREAD_SIGMASK) && !defined(HAVE_BROKEN_PTHREAD_SIGMASK)
120120
# define SET_THREAD_SIGMASK pthread_sigmask
121121
#else
122122
# define SET_THREAD_SIGMASK sigprocmask

configure

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 1.424 .
2+
# From configure.in Revision: 1.425 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.53 for python 2.3.
55
#
@@ -908,7 +908,7 @@ esac
908908
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
909909
# absolute.
910910
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
911-
ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
911+
ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
912912
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
913913
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
914914
@@ -11785,7 +11785,15 @@ if test `eval echo '${'$as_ac_var'}'` = yes; then
1178511785
cat >>confdefs.h <<_ACEOF
1178611786
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
1178711787
_ACEOF
11788+
case $ac_sys_system in
11789+
CYGWIN*)
1178811790
11791+
cat >>confdefs.h <<\_ACEOF
11792+
#define HAVE_BROKEN_PTHREAD_SIGMASK 1
11793+
_ACEOF
11794+
11795+
;;
11796+
esac
1178911797
fi
1179011798
done
1179111799
@@ -18502,7 +18510,7 @@ esac
1850218510
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
1850318511
# absolute.
1850418512
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
18505-
ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
18513+
ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
1850618514
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
1850718515
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
1850818516

configure.in

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,13 @@ if test "$posix_threads" = "yes"; then
17011701
if test "$ac_cv_pthread_system_supported" = "yes"; then
17021702
AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
17031703
fi
1704-
AC_CHECK_FUNCS(pthread_sigmask)
1704+
AC_CHECK_FUNCS(pthread_sigmask,
1705+
[case $ac_sys_system in
1706+
CYGWIN*)
1707+
AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
1708+
[Define if pthread_sigmask() does not work on your system.])
1709+
;;
1710+
esac])
17051711
fi
17061712

17071713

pyconfig.h.in

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
/* Define if the Posix semaphores do not work on your system */
4848
#undef HAVE_BROKEN_POSIX_SEMAPHORES
4949

50+
/* Define if pthread_sigmask() does not work on your system. */
51+
#undef HAVE_BROKEN_PTHREAD_SIGMASK
52+
5053
/* Define to 1 if you have the `chown' function. */
5154
#undef HAVE_CHOWN
5255

@@ -829,9 +832,6 @@
829832
/* Define on NetBSD to activate all library features */
830833
#undef _NETBSD_SOURCE
831834

832-
/* Define on FreeBSD to activate all library features */
833-
#undef __BSD_VISIBLE
834-
835835
/* Define _OSF_SOURCE to get the makedev macro. */
836836
#undef _OSF_SOURCE
837837

@@ -857,6 +857,9 @@
857857
/* Define to activate Unix95-and-earlier features */
858858
#undef _XOPEN_SOURCE_EXTENDED
859859

860+
/* Define on FreeBSD to activate all library features */
861+
#undef __BSD_VISIBLE
862+
860863
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
861864
#ifndef __CHAR_UNSIGNED__
862865
# undef __CHAR_UNSIGNED__

0 commit comments

Comments
 (0)