Add "memory" as clobber to the asm used by barrier().
[pintos-anon] / src / threads / synch.h
index 53a5ee488cf07c83f68a7b136bc6506136180ac9..9e464e3876400f60fafbc44a105f859ffd4b6938 100644 (file)
@@ -41,10 +41,10 @@ void cond_wait (struct condition *, struct lock *);
 void cond_signal (struct condition *, struct lock *);
 void cond_broadcast (struct condition *, struct lock *);
 
-/* Memory barrier.
+/* Optimization barrier.
 
-   The compiler will not reorder operations that access memory
-   across a memory barrier. */
-#define barrier() asm volatile ("")
+   The compiler will not reorder operations across an
+   optimization barrier. */
+#define barrier() asm volatile ("" : : : "memory")
 
 #endif /* threads/synch.h */