Mercurial > cpython-lru_cache-weakref
diff Python/thread_pthread.h @ 21534:2a785b668a16 2.1
backport of solaris thread patch, adding PTHREAD_SCOPE_SYSTEM support:
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.
This is a semi-feature, but makes such a huge difference to the
performance of Zope on Solaris that it's worthwhile (well, imho).
| author | Anthony Baxter <anthonybaxter@gmail.com> |
|---|---|
| date | Sun, 23 Dec 2001 04:07:25 +0000 |
| parents | 6f6f965c5e2d |
| children | 3a5515050b43 |
line wrap: on
line diff
--- a/Python/thread_pthread.h Sun Dec 23 01:47:10 2001 +0000 +++ b/Python/thread_pthread.h Sun Dec 23 04:07:25 2001 +0000 @@ -129,8 +129,15 @@ pthread_t th; int success; dprintf(("PyThread_start_new_thread called\n")); +#ifdef PTHREAD_SYSTEM_SCHED_SUPPORTED + pthread_attr_t attrs; +#endif if (!initialized) PyThread_init_thread(); +#ifdef PTHREAD_SYSTEM_SCHED_SUPPORTED + pthread_attr_init(&attrs); + pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM); +#endif success = pthread_create(&th, #if defined(PY_PTHREAD_D4) @@ -146,7 +153,11 @@ func, arg #elif defined(PY_PTHREAD_STD) +#ifdef PTHREAD_SYSTEM_SCHED_SUPPORTED + &attrs, +#else (pthread_attr_t*)NULL, +#endif (void* (*)(void *))func, (void *)arg #endif
