[pypy-commit] pypy default: Untested: try to fix an issue where the ctypes callback is invoked
arigo
noreply at buildbot.pypy.org
Wed Jul 1 13:08:21 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r78377:03f531cb70fe
Date: 2015-07-01 13:08 +0200
http://bitbucket.org/pypy/pypy/changeset/03f531cb70fe/
Log: Untested: try to fix an issue where the ctypes callback is invoked
in some unexpected thread
diff --git a/pypy/module/_rawffi/callback.py b/pypy/module/_rawffi/callback.py
--- a/pypy/module/_rawffi/callback.py
+++ b/pypy/module/_rawffi/callback.py
@@ -27,8 +27,10 @@
callback_ptr = global_counter.get(userdata.addarg)
w_callable = callback_ptr.w_callable
argtypes = callback_ptr.argtypes
+ must_leave = False
space = callback_ptr.space
try:
+ must_leave = space.threadlocals.try_enter_thread(space)
args_w = [None] * len(argtypes)
for i in range(len(argtypes)):
argtype = argtypes[i]
@@ -50,6 +52,8 @@
resshape = letter2tp(space, callback_ptr.result)
for i in range(resshape.size):
ll_res[i] = '\x00'
+ if must_leave:
+ space.threadlocals.leave_thread(space)
class W_CallbackPtr(W_DataInstance):
More information about the pypy-commit
mailing list