From 0a8eaa81df10983e6363814fce4cae5a0cb8bcf4 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Mon, 27 Feb 2017 13:32:28 +0200 Subject: [PATCH] Add volatile to spinlock variables Otherwise the loop inside spinlock_acquire will turn into an eternal loop when optimizations have been turned on. --- include/maxscale/spinlock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/maxscale/spinlock.h b/include/maxscale/spinlock.h index 4c08ec108..c0d46356b 100644 --- a/include/maxscale/spinlock.h +++ b/include/maxscale/spinlock.h @@ -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 */