Index: gcc/libgomp/config/linux/mutex.h |
diff --git a/gcc/libgomp/config/linux/mutex.h b/gcc/libgomp/config/linux/mutex.h |
index 07a2156a462966818f5e4066a4573004df251ca1..1905ce012fde79b8b57ccc5a338be8f2b895eebf 100644 |
--- a/gcc/libgomp/config/linux/mutex.h |
+++ b/gcc/libgomp/config/linux/mutex.h |
@@ -48,6 +48,16 @@ static inline void gomp_mutex_lock (gomp_mutex_t *mutex) |
extern void gomp_mutex_unlock_slow (gomp_mutex_t *mutex); |
static inline void gomp_mutex_unlock (gomp_mutex_t *mutex) |
{ |
+ /* Warning: By definition __sync_lock_test_and_set() does not have |
+ proper memory barrier semantics for a mutex unlock operation. |
+ However, this default implementation is written assuming that it |
+ does, which is true for some targets. |
+ |
+ Targets that require additional memory barriers before |
+ __sync_lock_test_and_set to achieve the release semantics of |
+ mutex unlock, are encouraged to include |
+ "config/linux/ia64/mutex.h" in a target specific mutex.h instead |
+ of using this file. */ |
int val = __sync_lock_test_and_set (mutex, 0); |
if (__builtin_expect (val > 1, 0)) |
gomp_mutex_unlock_slow (mutex); |