[Patches] [ python-Patches-684256 ] AutoThreadState implementation

SourceForge.net noreply@sourceforge.net
Sat, 19 Apr 2003 08:45:12 -0700


Patches item #684256, was opened at 2003-02-11 10:02
Message generated for change (Comment added) made by mhammond
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=684256&group_id=5470

Category: Core (C code)
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Mark Hammond (mhammond)
Assigned to: Mark Hammond (mhammond)
Summary: AutoThreadState implementation

Initial Comment:
An implementation of the AutoThreadState API, mainly
for discussion purposes at this point.  To be a PEP soon.

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

>Comment By: Mark Hammond (mhammond)
Date: 2003-04-20 01:45

Message:
Logged In: YES 
user_id=14198

Checking in Include/pystate.h;
new revision: 2.24; previous revision: 2.23
Checking in Include/pythread.h;
new revision: 2.21; previous revision: 2.20
Checking in Lib/test/test_capi.py;
new revision: 1.5; previous revision: 1.4
Checking in Modules/_testcapimodule.c;
new revision: 1.22; previous revision: 1.21
Checking in Modules/posixmodule.c;
new revision: 2.295; previous revision: 2.294
Checking in Python/ceval.c;
new revision: 2.359; previous revision: 2.358
Checking in Python/pystate.c;
new revision: 2.26; previous revision: 2.25
Checking in Python/pythonrun.c;
new revision: 2.191; previous revision: 2.190
Checking in Python/thread.c;
new revision: 2.46; previous revision: 2.45
Checking in Python/thread_sgi.h;
new revision: 2.17; previous revision: 2.16
















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

Comment By: Mark Hammond (mhammond)
Date: 2003-04-19 11:47

Message:
Logged In: YES 
user_id=14198

Attaching a new patch.  This corrects the clearing of the
threadstate, and uses the new names PyGILState_*.

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

Comment By: Greg Chapman (glchapman)
Date: 2003-03-05 04:44

Message:
Logged In: YES 
user_id=86307

It appears to me that PyAutoThreadState_Release calls 
PyThreadState_Clear after releasing the GIL (if the thread 
state was created by PyAutoThreadState_Ensure, then old 
state will be UNLOCKED, so PyEval_ReleaseThread will be 
called).  It looks to me that, if the thread state is going to be 
deleted, the call to Clear it should be moved up to just before 
ReleaseThread, i.e.:

if (oldstate == PyAutoThreadState_UNLOCKED) {
    if (tcur->autothreadstate_counter == 1)
        PyThreadState_Clear(tcur);
    PyEval_ReleaseThread(tcur);
}



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

Comment By: Mark Hammond (mhammond)
Date: 2003-02-14 00:05

Message:
Logged In: YES 
user_id=14198

Attaching a new patch that works perfectly.  2 checks remain
in the code that will be debug only, but apart from that, it
is pretty good.  No changes at all to existing semantics.

Tested on Linux and Windows.

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

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