diff options
author | Bruno Haible <bruno@clisp.org> | 2020-07-01 22:55:50 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-07-01 22:55:50 +0200 |
commit | 40dd30f1aa35f84cda62863946b0c0df32df17ba (patch) | |
tree | 87d1f61d87a726d725d7b933066e7eb7e072bb7d | |
parent | 2c208e6936378fc06222fe72abf50b9867ef8ed2 (diff) | |
download | gnulib-40dd30f1aa35f84cda62863946b0c0df32df17ba.tar.gz gnulib-40dd30f1aa35f84cda62863946b0c0df32df17ba.tar.bz2 |
windows-spin: Fix race condition on multiprocessor systems.
* lib/windows-spin.c (glwthread_spin_init): Add a memory barrier.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/windows-spin.c | 1 |
2 files changed, 6 insertions, 0 deletions
@@ -1,5 +1,10 @@ 2020-07-01 Bruno Haible <bruno@clisp.org> + windows-spin: Fix race condition on multiprocessor systems. + * lib/windows-spin.c (glwthread_spin_init): Add a memory barrier. + +2020-07-01 Bruno Haible <bruno@clisp.org> + pthread-spin: Add optimized fallback for GCC versions >= 4.1, < 4.7. * lib/pthread-spin.c (pthread_spin_init, pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock): For GCC >= 4.1, < 4.7, use diff --git a/lib/windows-spin.c b/lib/windows-spin.c index b90e7ae9dc..4643ac12f9 100644 --- a/lib/windows-spin.c +++ b/lib/windows-spin.c @@ -27,6 +27,7 @@ void glwthread_spin_init (glwthread_spinlock_t *lock) { lock->word = 0; + MemoryBarrier (); } int |