From a4350798d054973b1c8a6cbfc54edd8ddbe416b6 Mon Sep 17 00:00:00 2001 From: Jesus Cea Date: Mon, 14 Mar 2011 17:36:54 +0100 Subject: Issue #11495: OSF support is eliminated. It was deprecated in Python 3.2 --- Python/thread_pthread.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'Python/thread_pthread.h') diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index ffc791c578..7d36b920b5 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -228,8 +228,7 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) hosed" because: - It does not guarantee the promise that a non-zero integer is returned. - The cast to long is inherently unsafe. - - It is not clear that the 'volatile' (for AIX?) and ugly casting in the - latter return statement (for Alpha OSF/1) are any longer necessary. + - It is not clear that the 'volatile' (for AIX?) are any longer necessary. */ long PyThread_get_thread_ident(void) @@ -237,13 +236,8 @@ PyThread_get_thread_ident(void) volatile pthread_t threadid; if (!initialized) PyThread_init_thread(); - /* Jump through some hoops for Alpha OSF/1 */ threadid = pthread_self(); -#if SIZEOF_PTHREAD_T <= SIZEOF_LONG return (long) threadid; -#else - return (long) *(long *) &threadid; -#endif } void -- cgit v1.2.1 From 37cbd069c30e77278338b265655b9d9b37278fcd Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 24 Jun 2011 20:52:27 +0200 Subject: Issue #12392: fix thread initialization on FreeBSD 6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On FreeBSD6, pthread_kill() doesn't work on the main thread before the creation of the first thread. Create therefore a dummy thread (no-op) a startup to initialize the pthread library. Add also a test for this use case, test written by Charles-François Natali. --- Python/thread_pthread.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Python/thread_pthread.h') diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index 09a0887bd4..fe9dde6f52 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -144,7 +144,10 @@ typedef struct { * Initialization. */ -#ifdef _HAVE_BSDI +/* On FreeBSD6, pthread_kill() doesn't work on the main thread before + the creation of the first thread */ +#if defined(_HAVE_BSDI) \ + || (defined(__FreeBSD__) && __FreeBSD_version < 700000) static void _noop(void) { -- cgit v1.2.1 From edf83ba036d27d56f63513a434766ce129f38610 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 4 Jul 2011 22:53:49 +0200 Subject: Issue #12469: partial revert of 024827a9db64, freebsd6 thread initialization * Don't create a thread at startup anymore to initialize the pthread library: it changes the behaviour of many functions related to signal handling like sigwait() * Reenable test_sigtimedwait_poll() on FreeBSD 6 --- Python/thread_pthread.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Python/thread_pthread.h') diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index fe9dde6f52..4b61e18941 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -144,10 +144,7 @@ typedef struct { * Initialization. */ -/* On FreeBSD6, pthread_kill() doesn't work on the main thread before - the creation of the first thread */ -#if defined(_HAVE_BSDI) \ - || (defined(__FreeBSD__) && __FreeBSD_version < 700000) +#if defined(_HAVE_BSDI) static void _noop(void) { -- cgit v1.2.1 From 8bfa3df4bcf0163ddbae0557227e73c4ff4eef09 Mon Sep 17 00:00:00 2001 From: Kristj?n Valur J?nsson Date: Tue, 5 Jun 2012 22:17:42 +0000 Subject: Signal condition variables with the mutex held. Destroy condition variables before their mutexes. --- Python/thread_pthread.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'Python/thread_pthread.h') diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index 4f9e2c19d6..5007aaf0b7 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -443,12 +443,15 @@ PyThread_free_lock(PyThread_type_lock lock) dprintf(("PyThread_free_lock(%p) called\n", lock)); - status = pthread_mutex_destroy( &thelock->mut ); - CHECK_STATUS("pthread_mutex_destroy"); - + /* some pthread-like implementations tie the mutex to the cond + * and must have the cond destroyed first. + */ status = pthread_cond_destroy( &thelock->lock_released ); CHECK_STATUS("pthread_cond_destroy"); + status = pthread_mutex_destroy( &thelock->mut ); + CHECK_STATUS("pthread_mutex_destroy"); + free((void *)thelock); } @@ -531,12 +534,12 @@ PyThread_release_lock(PyThread_type_lock lock) thelock->locked = 0; - status = pthread_mutex_unlock( &thelock->mut ); - CHECK_STATUS("pthread_mutex_unlock[3]"); - /* wake up someone (anyone, if any) waiting on the lock */ status = pthread_cond_signal( &thelock->lock_released ); CHECK_STATUS("pthread_cond_signal"); + + status = pthread_mutex_unlock( &thelock->mut ); + CHECK_STATUS("pthread_mutex_unlock[3]"); } #endif /* USE_SEMAPHORES */ -- cgit v1.2.1