Commit graph

56 commits

Author SHA1 Message Date
Armin Rigo
a6eb56cf46 Don't call memset() before checking that the ptr is not NULL. 2005-09-20 18:07:47 +00:00
Martin v. Löwis
8b8fb3db5a Add 0 to _POSIX_SEMAPHORES. Will backport to 2.4. 2005-03-28 12:34:20 +00:00
Anthony Baxter
19b2369d42 Patch #1163249 - Correctly handle _POSIX_SEMAPHORES == -1 to mean no
support for posix semaphores.
2005-03-16 04:15:07 +00:00
Michael W. Hudson
30ea2f223f This closes patch:
[ 960406 ] unblock signals in threads

although the changes do not correspond exactly to any patch attached to
that report.

Non-main threads no longer have all signals masked.

A different interface to readline is used.

The handling of signals inside calls to PyOS_Readline is now rather
different.

These changes are all a bit scary!  Review and cross-platform testing
much appreciated.
2004-07-07 17:44:12 +00:00
Hye-Shik Chang
30e97dbe96 SF Patch #902444: Use process scope thread on FreeBSD. System scope
is too expensive on FreeBSD's KSE threading infrastructure and
even test_threadedimport fails on default setting.
2004-03-04 06:35:57 +00:00
Skip Montanaro
6babcc2ad4 typo 2004-03-03 08:42:23 +00:00
Skip Montanaro
f1afe6682c Remove support for systems defining Py_PTHREAD_D[467] in
Python/thread_pthread.h.
2004-02-07 13:00:18 +00:00
Skip Montanaro
4d474becd8 remove DGUX support. 2004-01-17 00:29:32 +00:00
Jack Jansen
4bae2d5e46 Getting rid of code dependent on GUSI or the MetroWerks compiler. 2003-11-19 22:52:23 +00:00
Jason Tishler
fac083d14a 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.
2003-07-22 15:20:49 +00:00
Martin v. Löwis
910ae6283a Patch #716969: Detect thread creation failure. Will backport to 2.2. 2003-04-19 07:44:52 +00:00
Martin v. Löwis
1509a152b3 Patch #711835: Remove unnecessary lock operations. Will backport to 2.2. 2003-04-18 11:11:09 +00:00
Martin v. Löwis
dfc33fd8db Don't use Posix semaphores on Solaris 8. Fixes #662787. 2003-01-21 10:14:41 +00:00
Martin v. Löwis
b023381466 Patch #650415: Avoid redefinition of macros. 2002-12-11 13:12:30 +00:00
Martin v. Löwis
779ffc066e Add compile-time errors for unsupported systems. 2002-12-02 22:17:01 +00:00
Martin v. Löwis
a7a76d3d9e Patch #618347: Work around Solaris 2.6 pthread.h bug. Will backport to 2.2. 2002-10-04 07:21:24 +00:00
Martin v. Löwis
42ab61eeab Document that _POSIX_SEMAPHORES is predefined. 2002-03-17 17:19:00 +00:00
Martin v. Löwis
cc89866b65 Patch #525532: Add support for POSIX semaphores. 2002-03-17 09:53:51 +00:00
Fred Drake
7bb1c9a11d Remove the unused & broken PyThread_*_sema() functions and related constants.
This closes SF patch #504215.
2002-01-19 22:02:55 +00:00
Jack Jansen
7668957508 Workaround for what is probably a problem in Apple's gcc: <pthread.h> fails
on a function pointer formal argument called "destructor", which is typedeffed
as a different function pointer type in object.h.
2002-01-15 20:36:14 +00:00
Fred Drake
03459a5cd7 Fix memory leak. This is part of SF patch #478006. 2001-11-09 16:00:41 +00:00
Guido van Rossum
3c28863e08 Partial patch from SF #452266, by Jason Petrone.
This changes Pythread_start_thread() to return the thread ID, or -1
for an error.  (It's technically an incompatible API change, but I
doubt anyone calls it.)
2001-10-16 21:13:49 +00:00
Martin v. Löwis
69c0ff3836 Do not define _POSIX_THREADS if unistd.h defines it.
Check for pthread_sigmask before using it. Fixes remaining problem in #470781.
2001-10-15 14:34:42 +00:00
Guido van Rossum
80230998b9 Add SF patch #468347 -- mask signals for non-main pthreads, by Jason Lowe:
This patch updates Python/thread_pthread.h to mask all
   signals for any thread created. This will keep all
   signals masked for any thread that isn't the initial
   thread. For Solaris and Linux, the two platforms I was
   able to test it on, it solves bug #465673 (pthreads
   need signal protection) and probably will solve bug
   #219772 (Interactive InterPreter+ Thread -> core dump
   at exit).

   I'd be great if this could get some testing on other
   platforms, especially HP-UX pre 11.00 and post 11.00,
   as I had to make some guesses for the DCE thread case.
   AIX is also a concern as I saw some mention of using
   sigthreadmask() as a pthread_sigmask() equivalent, but
   this patch doesn't use sigthreadmask(). I don't have
   access to AIX.
2001-10-12 21:49:17 +00:00
Guido van Rossum
d0b69eceb4 Improve threading on Solaris, according to SF patch #460269, submitted
by bbrox@bbrox.org / lionel.ulmer@free.fr.

This adds a configure check and if all goes well turns on the
PTHREAD_SCOPE_SYSTEM thread attribute for new threads.

This should remove the need to add tiny sleeps at the start of threads
to allow other threads to be scheduled.
2001-09-10 14:10:54 +00:00
Jack Jansen
c51395d797 GUSI on the Mac creates threads with a default stack size of 20KB, which is
not enough for Python. Increased the stacksize to a (somewhat arbitrary)
64KB.
2001-08-29 15:24:53 +00:00
Guido van Rossum
8586991099 REMOVED all CWI, CNRI and BeOpen copyright markings.
This should match the situation in the 1.6b1 tree.
2000-09-01 23:29:29 +00:00
Trent Mick
635f6fb0e9 This patch partly (some stuff went in already) ports Python to Monterey.
- Fix bug in thread_pthread.h::PyThread_get_thread_ident() where
  sizeof(pthread) < sizeof(long).
- Add 'configure' for:
	- SIZEOF_PTHREAD is pthread_t can be included via <pthread.h>
	- setting Monterey system name
	- appropriate CC,LINKCC,LDSHARED,OPT, and CCSHARED for Monterey
- Add section in README for Monterey build
2000-08-23 21:33:05 +00:00
Thomas Wouters
f70ef4f860 Mass ANSIfication of function definitions. Doesn't cover all 'extern'
declarations yet, those come later.
2000-07-22 18:47:25 +00:00
Guido van Rossum
ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum
fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Fred Drake
a44d353e2b Trent Mick <trentm@activestate.com>:
The common technique for printing out a pointer has been to cast to a long
and use the "%lx" printf modifier. This is incorrect on Win64 where casting
to a long truncates the pointer. The "%p" formatter should be used instead.

The problem as stated by Tim:
> Unfortunately, the C committee refused to define what %p conversion "looks
> like" -- they explicitly allowed it to be implementation-defined. Older
> versions of Microsoft C even stuck a colon in the middle of the address (in
> the days of segment+offset addressing)!

The result is that the hex value of a pointer will maybe/maybe not have a 0x
prepended to it.


Notes on the patch:

There are two main classes of changes:
- in the various repr() functions that print out pointers
- debugging printf's in the various thread_*.h files (these are why the
patch is large)


Closes SourceForge patch #100505.
2000-06-30 15:01:00 +00:00
Guido van Rossum
701f25ef9d Rob Riggs wrote:
"""
Spec says that on success pthread_create returns 0. It does not say
that an error code will be < 0. Linux glibc2 pthread_create() returns
ENOMEM (12) when one exceed process limits. (It looks like it should
return EAGAIN, but that's another story.)

For reference, see:
http://www.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html
"""

[I have a feeling that similar bugs were fixed before; perhaps someone
could check that all error checks no check for != 0?]
1999-03-15 20:27:53 +00:00
Guido van Rossum
65d5b5763c Thanks to Chris Herborth, the thread primitives now have proper Py*
names in the source code (they already had those for the linker,
through some smart macros; but the source still had the old, un-Py names).
1998-12-21 19:32:43 +00:00
Guido van Rossum
9e46e56264 BSDI specific patches, inspired by Nigel Head and otto@mail.olympus.net.
Also (non-BSDI specific):

- Change the CHECK_STATUS() macro so it tests for nonzero error codes
instead of negative error codes only (this was needed for BSDI, but
appears to be correct according to the PTHREADS spec).

- use memset() to zero out the allocated lock structure.  Again, this
was needed for BSDI, but can't hurt elsewhere either.
1998-10-07 16:39:47 +00:00
Guido van Rossum
d21744a1dd Apparently on AIX when using gcc you need to call pthread_init()
(which is not a POSIX threads call!).  Reported and confirmed by Brad
Howes.
1998-09-10 03:04:40 +00:00
Guido van Rossum
a74d0e4c55 Correct typo in #ifdef: PY_THREAD_D4, should be PY_PTHREAD_D4.
Reported by Jonathan Giddy.
1998-09-04 13:38:32 +00:00
Guido van Rossum
44ee479427 Add a 'volatile' to the declaration of threadid in get_thread_ident().
According to Vladimir Marangozov, this is necessary for AIX, where
high optimization levels inline this function and then get it wrong :-(
1998-08-27 19:21:53 +00:00
Guido van Rossum
532246ef55 Improved version of patch for HPUX from David Arnold. 1998-05-14 21:01:27 +00:00
Guido van Rossum
89df70bfbb Support HPUX 10.20 DCE threads. 1998-05-07 13:28:23 +00:00
Guido van Rossum
730806d3d9 Make new gcc -Wall happy 1998-04-10 22:27:42 +00:00
Guido van Rossum
46ff1903a3 Add default case (standard conformance) to avoid piling up
system specific #ifdefs.
1997-06-02 22:25:45 +00:00
Guido van Rossum
64f9105fb7 DG/UX thread patches (Ross Andrus) 1997-05-22 20:41:59 +00:00
Guido van Rossum
c8fba8ee14 Add pthred-std define for Linux. 1997-05-15 12:24:53 +00:00
Guido van Rossum
d6353e2c0e Support for various versions of the pthread draft. 1997-05-13 17:51:13 +00:00
Guido van Rossum
f4806c2a85 Add detach call so threads are GC'ed. 1997-04-30 19:59:22 +00:00
Guido van Rossum
7af8130857 Working semaphore implementation by Sjoerd. 1997-01-17 21:06:41 +00:00
Guido van Rossum
d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum
cf1474b73a Sjoerd's thread changes (including down_sema typo fix).
Note: waitflag not supported on NT.
1996-10-08 14:17:53 +00:00
Guido van Rossum
1a62311cfb Changes necessary for AIX. 1996-08-08 18:53:41 +00:00