diff options
author | Simon Marlow <marlowsd@gmail.com> | 2010-06-10 08:06:36 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2010-06-10 08:06:36 +0000 |
commit | 565f3c753ccedeb19b5b8190090241a2185eb0cb (patch) | |
tree | 9396ad7223765464ccd7071209ef2e4e2faf39ab /includes/stg | |
parent | 5ac6359ebd27b7a84eb63a3ea779d9ce6659ce76 (diff) | |
download | haskell-565f3c753ccedeb19b5b8190090241a2185eb0cb.tar.gz |
messageBlackHole: fix deadlock bug caused by a missing 'volatile'
Diffstat (limited to 'includes/stg')
-rw-r--r-- | includes/stg/SMP.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/includes/stg/SMP.h b/includes/stg/SMP.h index b302f4886b..ad8c0baef9 100644 --- a/includes/stg/SMP.h +++ b/includes/stg/SMP.h @@ -293,6 +293,12 @@ load_load_barrier(void) { #endif } +// Load a pointer from a memory location that might be being modified +// concurrently. This prevents the compiler from optimising away +// multiple loads of the memory location, as it might otherwise do in +// a busy wait loop for example. +#define VOLATILE_LOAD(p) (*((StgVolatilePtr)(p))) + /* ---------------------------------------------------------------------- */ #else /* !THREADED_RTS */ @@ -331,6 +337,8 @@ atomic_dec(StgVolatilePtr p) return --(*p); } +#define VOLATILE_LOAD(p) ((StgWord)*((StgWord*)(p))) + #endif /* !THREADED_RTS */ #endif /* SMP_H */ |