Author: Armin Rigo <[email protected]>
Branch: static-callback-embedding
Changeset: r2572:e294dc8697d0
Date: 2016-01-12 19:36 +0100
http://bitbucket.org/cffi/cffi/changeset/e294dc8697d0/

Log:    Ups, found the bug

diff --git a/cffi/_embedding.h b/cffi/_embedding.h
--- a/cffi/_embedding.h
+++ b/cffi/_embedding.h
@@ -44,7 +44,8 @@
 #else
    /* --- Windows threads version --- */
 # include <Windows.h>
-# define cffi_compare_and_swap(l,o,n)  InterlockedCompareExchangePointer(l,n,o)
+# define cffi_compare_and_swap(l,o,n) \
+                               (InterlockedCompareExchangePointer(l,n,o) == 
(o))
 # define cffi_write_barrier()       
InterlockedCompareExchange(&_cffi_dummy,0,0)
 # define cffi_read_barrier()           (void)0
 static volatile LONG _cffi_dummy;
@@ -62,7 +63,7 @@
 
 static void _cffi_acquire_reentrant_mutex(void)
 {
-    static volatile void *lock = NULL;
+    static void *volatile lock = NULL;
 
     while (!cffi_compare_and_swap(&lock, NULL, (void *)1)) {
         /* should ideally do a spin loop instruction here, but
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to