Author: Amaury Forgeot d'Arc <[email protected]>
Branch: cpyext-PyThreadState_New
Changeset: r57660:5263c8be8652
Date: 2012-09-29 08:47 +0200
http://bitbucket.org/pypy/pypy/changeset/5263c8be8652/
Log: Move ll_thread.gc_thread_start() and llthread.gc_thread_die() to
places where the GIL is held.
diff --git a/pypy/module/cpyext/pystate.py b/pypy/module/cpyext/pystate.py
--- a/pypy/module/cpyext/pystate.py
+++ b/pypy/module/cpyext/pystate.py
@@ -232,11 +232,11 @@
object. The global interpreter lock need not be held, but may be held if
it is necessary to serialize calls to this function."""
ll_thread.gc_thread_prepare()
- ll_thread.gc_thread_start()
# PyThreadState_Get will allocate a new execution context,
# we need to protect gc and other globals with the GIL.
rffi.aroundstate.after()
try:
+ ll_thread.gc_thread_start()
return PyThreadState_Get(space)
finally:
rffi.aroundstate.before()
@@ -249,17 +249,17 @@
tstate.c_dict = lltype.nullptr(PyObject.TO)
space.threadlocals.leave_thread(space)
space.getexecutioncontext().cleanup_cpyext_state()
+ ll_thread.gc_thread_die()
@cpython_api([PyThreadState], lltype.Void)
def PyThreadState_Delete(space, tstate):
"""Destroy a thread state object. The global interpreter lock need not
be held. The thread state must have been reset with a previous call to
PyThreadState_Clear()."""
- ll_thread.gc_thread_die()
@cpython_api([], lltype.Void)
def PyThreadState_DeleteCurrent(space):
"""Destroy a thread state object. The global interpreter lock need not
be held. The thread state must have been reset with a previous call to
PyThreadState_Clear()."""
- ll_thread.gc_thread_die()
+
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit