[Patches] [ python-Patches-460269 ] Improve threading on Solaris platform.

noreply@sourceforge.net noreply@sourceforge.net
Mon, 10 Sep 2001 11:53:41 -0700


Patches item #460269, was opened at 2001-09-10 06:30
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=460269&group_id=5470

Category: Core (C code)
Group: None
Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Improve threading on Solaris platform.

Initial Comment:
To have threading working 'as expected' (i.e. threads
that are preempted by the OS and NOT threads that need
to have explicit yields), they need to have the
'SYSTEM_SCOPE' attribute set at thread creation on the
Solaris platform (at least on SPARC, did not check on
x86).

This patch adds :
 - a configure check to see if threads can be created
with this attribute without returning an error
 - the setting of this attribute in the 'standard' case
(all draft versions are ignored).

This patch NEEDS to be tested on more than one Unices
using POSIX threads to be sure that it does not break
anything (I only tested it on Solaris).

The configure check is a bit awkward as I wanted to
actually run some threading programs, so I needed to
have all the parameters (CC and LIBS) set properly.
Maybe a better way could be found.

The attached patch is against version 2.2.a3.

Should a patch also be sent for 2.0 or 2.1 releases as
a bug fix ?

(see comp.langage.python discussion for more details)


----------------------------------------------------------------------

Comment By: Lionel Ulmer (bbrox)
Date: 2001-09-10 11:53

Message:
Logged In: YES 
user_id=1344

Thanks for the commit.

As for my patch, I did the 'minimize risk' approach by
changing the less code as possible.

But I agree that, according to the man pages and the POSIX
threads documentations that passing 'attrs' (initialized
with 'pthread_attr_init') should be completely equivalent to
passing NULL. So, at least in the 'PY_PTHREAD_STD' case, we
could always use 'attrs' and never the NULL attributes
(anyway, I think that with my patch, all of the POSIX
compliant pthread libraries will support the SCOPE_SYSTEM
attribute and thus the NULL case will almost never be used).

By the way, once this has been tested, should I generate a
patch for 2.1 / 2.0 ?



----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-10 07:10

Message:
Logged In: YES 
user_id=6380

Looks good to me, and checked in.

Do you know of any reason why we couldn't always declare the
'attrs' variable, initialize it, and pass it to
pthread_create()? That would save a lot of #ifdef mess in
PyThread_start_new_thread().

----------------------------------------------------------------------

Comment By: Lionel Ulmer (bbrox)
Date: 2001-09-10 06:34

Message:
Logged In: YES 
user_id=1344

Just to say that I somewhat screwed up and posted this patch
as 'nobody' whereas I have an SF account...

So for any comments, please send mail to bbrox@bbrox.org or
lionel.ulmer@free.fr.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=460269&group_id=5470