[pypy-svn] pypy default: Bah, c_thread_lock_init was declared to return Void anyway :-(

arigo commits-noreply at bitbucket.org
Thu Feb 10 17:28:06 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41793:402bab283b1d
Date: 2011-02-10 17:25 +0100
http://bitbucket.org/pypy/pypy/changeset/402bab283b1d/

Log:	Bah, c_thread_lock_init was declared to return Void anyway :-(

diff --git a/pypy/module/thread/ll_thread.py b/pypy/module/thread/ll_thread.py
--- a/pypy/module/thread/ll_thread.py
+++ b/pypy/module/thread/ll_thread.py
@@ -49,7 +49,7 @@
 TLOCKP = rffi.COpaquePtr('struct RPyOpaque_ThreadLock',
                           compilation_info=eci)
 
-c_thread_lock_init = llexternal('RPyThreadLockInit', [TLOCKP], lltype.Void)
+c_thread_lock_init = llexternal('RPyThreadLockInit', [TLOCKP], rffi.INT)
 c_thread_acquirelock = llexternal('RPyThreadAcquireLock', [TLOCKP, rffi.INT],
                                   rffi.INT,
                                   threadsafe=True)    # release the GIL
@@ -133,7 +133,7 @@
     # lock objects, as well as from the GIL, which exists at shutdown.
     ll_lock = lltype.malloc(TLOCKP.TO, flavor='raw', track_allocation=False)
     res = c_thread_lock_init(ll_lock)
-    if res <= 0:
+    if rffi.cast(lltype.Signed, res) <= 0:
         lltype.free(ll_lock, flavor='raw', track_allocation=False)
         raise error("out of resources")
     return ll_lock


More information about the Pypy-commit mailing list