[pypy-commit] pypy ec-keepalive: Potential fix: need to use __sync_lock_release() here
arigo
pypy.commits at gmail.com
Mon Jan 4 19:59:01 EST 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: ec-keepalive
Changeset: r81563:2f853825ff8f
Date: 2016-01-05 01:21 +0100
http://bitbucket.org/pypy/pypy/changeset/2f853825ff8f/
Log: Potential fix: need to use __sync_lock_release() here
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
@@ -48,7 +48,7 @@
}
static inline void _RPyGilRelease(void) {
assert(RPY_FASTGIL_LOCKED(rpy_fastgil));
- rpy_fastgil = 0;
+ lock_release(&rpy_fastgil);
}
static inline long *_RPyFetchFastGil(void) {
return &rpy_fastgil;
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
@@ -38,3 +38,4 @@
#else
#define lock_test_and_set(ptr, value) InterlockedExchange(ptr, value)
#endif
+#define lock_release(ptr) (*((volatile long *)ptr) = 0)
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
@@ -81,3 +81,4 @@
#define lock_test_and_set(ptr, value) __sync_lock_test_and_set(ptr, value)
+#define lock_release(ptr) __sync_lock_release(ptr)
More information about the pypy-commit
mailing list