[pypy-svn] r48931 - pypy/dist/pypy/module/thread
arigo at codespeak.net
arigo at codespeak.net
Thu Nov 22 17:48:29 CET 2007
Author: arigo
Date: Thu Nov 22 17:48:27 2007
New Revision: 48931
Modified:
pypy/dist/pypy/module/thread/gil.py
Log:
Fragile code to preserve the errno...
Modified: pypy/dist/pypy/module/thread/gil.py
==============================================================================
--- pypy/dist/pypy/module/thread/gil.py (original)
+++ pypy/dist/pypy/module/thread/gil.py Thu Nov 22 17:48:27 2007
@@ -12,6 +12,7 @@
from pypy.interpreter.miscutils import Action
from pypy.module.thread.threadlocals import OSThreadLocals
from pypy.rlib.objectmodel import invoke_around_extcall
+from pypy.rlib.rposix import get_errno, set_errno
class GILThreadLocals(OSThreadLocals):
"""A version of OSThreadLocals that enforces a GIL."""
@@ -83,10 +84,16 @@
pass
spacestate = SpaceState()
+# Fragile code below. We have to preserve the C-level errno manually...
+
def before_external_call():
# this function must not raise, in such a way that the exception
# transformer knows that it cannot raise!
+ e = get_errno()
spacestate.GIL.release()
+ set_errno(e)
def after_external_call():
+ e = get_errno()
spacestate.GIL.acquire(True)
+ set_errno(e)
More information about the pypy-svn
mailing list