Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Oct 2008 19:10:49 +0300
From:      Andriy Pylypenko <bambyster@gmail.com>
To:        python@FreeBSD.org
Subject:   Python 2.4+ and signals
Message-ID:  <4901F389.3060901@gmail.com>

index | next in thread | raw e-mail

[-- Attachment #1 --]
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


[-- Attachment #2 --]
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);
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4901F389.3060901>