Add volatile to spinlock variables

Otherwise the loop inside spinlock_acquire will turn into an
eternal loop when optimizations have been turned on.
This commit is contained in:
Johan Wikman
2017-02-27 13:32:28 +02:00
parent 870a72ae71
commit 0a8eaa81df

View File

@ -42,7 +42,7 @@ MXS_BEGIN_DECLS
*/
typedef struct spinlock
{
int lock; /*< Is the lock held? */
volatile int lock;/*< Is the lock held? */
#if SPINLOCK_PROFILE
int spins; /*< Number of spins on this lock */
int maxspins; /*< Max no of spins to acquire lock */