From owner-freebsd-python@FreeBSD.ORG Fri Oct 24 16:33:33 2008 Return-Path: Delivered-To: python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA7D31065674 for ; Fri, 24 Oct 2008 16:33:33 +0000 (UTC) (envelope-from bambyster@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) by mx1.freebsd.org (Postfix) with ESMTP id 695258FC23 for ; Fri, 24 Oct 2008 16:33:33 +0000 (UTC) (envelope-from bambyster@gmail.com) Received: by ug-out-1314.google.com with SMTP id m2so212557uge.39 for ; Fri, 24 Oct 2008 09:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=Q47kgclTEAmULo2jMGd0k3CANaO6htkGNs3gAhMO/es=; b=mj6iSD8djFqBIyjWNWSDQVfViB4LUDttuo3gJ4EcaOjkI8MyAaVj5KXfdFSn/W+gmu vsJDNyWnohVAlqMpVgNLH68WeRW8K3X62iTNcF5uJcBj4BZD9wVxPKX5aEFog8NjsKqL lLYRet26ebstc1Xp9mpGw5Haq4mrWGSBAjWxQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=GyIIErcydtwAMdzS3m/WfmA0vTRuP5DzIj8Oc1ZOHj9shccObaLsCnQyQ64UnuQAPG 93u9HFmn9yjdZciIn+LA8E8gABDCvMkvHfyNHfpDCfMs0rMSJ1LXuxWdiLyRLD7Gfzhp XJfFl/zgaMON6Aq4R32Hh8Rj3mafY0lZ9FzLE= Received: by 10.180.239.7 with SMTP id m7mr905517bkh.163.1224864653327; Fri, 24 Oct 2008 09:10:53 -0700 (PDT) Received: from sempron.sippysoft.com (212.9.228.2.iptelecom.net.ua [212.9.228.2]) by mx.google.com with ESMTPS id l19sm815827fgb.7.2008.10.24.09.10.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 24 Oct 2008 09:10:52 -0700 (PDT) Message-ID: <4901F389.3060901@gmail.com> Date: Fri, 24 Oct 2008 19:10:49 +0300 From: Andriy Pylypenko User-Agent: Thunderbird 2.0.0.16 (X11/20080801) MIME-Version: 1.0 To: python@FreeBSD.org Content-Type: multipart/mixed; boundary="------------020605000400080601090305" Cc: Subject: Python 2.4+ and signals 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: Fri, 24 Oct 2008 16:33:33 -0000 This is a multi-part message in MIME format. --------------020605000400080601090305 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hello, Early this year I've reported to the Python developers a problem in Python that has been triggered by peculiarities of processing of signals in FreeBSD together with a third party patch committed to the Python 2.4 ( http://bugs.python.org/issue960406 ). The detailed description of the problem with example script and patch you can find here: http://bugs.python.org/issue1975 Anyway the issue has stuck since then so I'm submitting the patch here so it can be included in the FreeBSD Python ports. P.S. Just in case I've attached the patch to this message. The patch is compatible with all versions of Python from 2.4 through 3.0. -- Kind regards, Andriy Pylypenko Development Lead Sippy Software, Inc. Internet Telephony (VoIP) Experts T/F: +1-646-651-1110 Web: http://www.sippysoft.com --------------020605000400080601090305 Content-Type: text/x-patch; name="pthread_sig.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pthread_sig.diff" Index: Python/thread_pthread.h =================================================================== --- Python/thread_pthread.h (revision 60447) +++ Python/thread_pthread.h (working copy) @@ -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,6 +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); --------------020605000400080601090305--