Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r83301:4ad4991ec0ab
Date: 2016-03-23 19:17 +0100
http://bitbucket.org/pypy/pypy/changeset/4ad4991ec0ab/

Log:    A macro called lock_release() seems to create conflicts on some OS/X
        systems.

diff --git a/rpython/translator/c/src/thread.h 
b/rpython/translator/c/src/thread.h
--- a/rpython/translator/c/src/thread.h
+++ b/rpython/translator/c/src/thread.h
@@ -42,13 +42,13 @@
 RPY_EXTERN long rpy_fastgil;
 
 static inline void _RPyGilAcquire(void) {
-    long old_fastgil = lock_test_and_set(&rpy_fastgil, 1);
+    long old_fastgil = pypy_lock_test_and_set(&rpy_fastgil, 1);
     if (old_fastgil != 0)
         RPyGilAcquireSlowPath(old_fastgil);
 }
 static inline void _RPyGilRelease(void) {
     assert(RPY_FASTGIL_LOCKED(rpy_fastgil));
-    lock_release(&rpy_fastgil);
+    pypy_lock_release(&rpy_fastgil);
 }
 static inline long *_RPyFetchFastGil(void) {
     return &rpy_fastgil;
diff --git a/rpython/translator/c/src/thread_gil.c 
b/rpython/translator/c/src/thread_gil.c
--- a/rpython/translator/c/src/thread_gil.c
+++ b/rpython/translator/c/src/thread_gil.c
@@ -70,7 +70,7 @@
 {
     /* Acquires the GIL.  This assumes that we already did:
 
-          old_fastgil = lock_test_and_set(&rpy_fastgil, 1);
+          old_fastgil = pypy_lock_test_and_set(&rpy_fastgil, 1);
      */
     if (!RPY_FASTGIL_LOCKED(old_fastgil)) {
         /* The fastgil was not previously locked: success.
@@ -122,7 +122,7 @@
                released.
             */
             if (!RPY_FASTGIL_LOCKED(rpy_fastgil)) {
-                old_fastgil = lock_test_and_set(&rpy_fastgil, 1);
+                old_fastgil = pypy_lock_test_and_set(&rpy_fastgil, 1);
                 if (!RPY_FASTGIL_LOCKED(old_fastgil))
                     /* yes, got a non-held value!  Now we hold it. */
                     break;
diff --git a/rpython/translator/c/src/thread_nt.c 
b/rpython/translator/c/src/thread_nt.c
--- a/rpython/translator/c/src/thread_nt.c
+++ b/rpython/translator/c/src/thread_nt.c
@@ -245,7 +245,7 @@
     LeaveCriticalSection(mutex);
 }
 
-//#define lock_test_and_set(ptr, value)  see thread_nt.h
+//#define pypy_lock_test_and_set(ptr, value)  see thread_nt.h
 #define atomic_increment(ptr)          InterlockedIncrement(ptr)
 #define atomic_decrement(ptr)          InterlockedDecrement(ptr)
 
diff --git a/rpython/translator/c/src/thread_nt.h 
b/rpython/translator/c/src/thread_nt.h
--- a/rpython/translator/c/src/thread_nt.h
+++ b/rpython/translator/c/src/thread_nt.h
@@ -34,8 +34,8 @@
 
 #ifdef _M_IA64
 /* On Itanium, use 'acquire' memory ordering semantics */
-#define lock_test_and_set(ptr, value)  InterlockedExchangeAcquire(ptr, value)
+#define pypy_lock_test_and_set(ptr, value) 
InterlockedExchangeAcquire(ptr,value)
 #else
-#define lock_test_and_set(ptr, value)  InterlockedExchange(ptr, value)
+#define pypy_lock_test_and_set(ptr, value) InterlockedExchange(ptr, value)
 #endif
-#define lock_release(ptr)              (*((volatile long *)ptr) = 0)
+#define pypy_lock_release(ptr)             (*((volatile long *)ptr) = 0)
diff --git a/rpython/translator/c/src/thread_pthread.c 
b/rpython/translator/c/src/thread_pthread.c
--- a/rpython/translator/c/src/thread_pthread.c
+++ b/rpython/translator/c/src/thread_pthread.c
@@ -546,7 +546,7 @@
     return result;
 }
 
-//#define lock_test_and_set(ptr, value)  see thread_pthread.h
+//#define pypy_lock_test_and_set(ptr, value)  see thread_pthread.h
 #define atomic_increment(ptr)          __sync_fetch_and_add(ptr, 1)
 #define atomic_decrement(ptr)          __sync_fetch_and_sub(ptr, 1)
 #define HAVE_PTHREAD_ATFORK            1
diff --git a/rpython/translator/c/src/thread_pthread.h 
b/rpython/translator/c/src/thread_pthread.h
--- a/rpython/translator/c/src/thread_pthread.h
+++ b/rpython/translator/c/src/thread_pthread.h
@@ -80,5 +80,5 @@
 void RPyThreadAfterFork(void);
 
 
-#define lock_test_and_set(ptr, value)  __sync_lock_test_and_set(ptr, value)
-#define lock_release(ptr)              __sync_lock_release(ptr)
+#define pypy_lock_test_and_set(ptr, value)  __sync_lock_test_and_set(ptr, 
value)
+#define pypy_lock_release(ptr)              __sync_lock_release(ptr)
diff --git a/rpython/translator/c/src/threadlocal.c 
b/rpython/translator/c/src/threadlocal.c
--- a/rpython/translator/c/src/threadlocal.c
+++ b/rpython/translator/c/src/threadlocal.c
@@ -15,14 +15,14 @@
 static int check_valid(void);
 
 void _RPython_ThreadLocals_Acquire(void) {
-    while (!lock_test_and_set(&pypy_threadlocal_lock, 1)) {
+    while (!pypy_lock_test_and_set(&pypy_threadlocal_lock, 1)) {
         /* busy loop */
     }
     assert(check_valid());
 }
 void _RPython_ThreadLocals_Release(void) {
     assert(check_valid());
-    lock_release(&pypy_threadlocal_lock);
+    pypy_lock_release(&pypy_threadlocal_lock);
 }
 
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to