aboutsummaryrefslogtreecommitdiffstats
path: root/erts/include/internal/pthread/ethr_event.h
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2010-12-03 10:57:26 +0100
committerRickard Green <[email protected]>2010-12-11 03:03:19 +0100
commitb297bfdd47b0a39831d8cc2541aeb910f9af0bca (patch)
tree59ac65b0d0bc95879d9507900781acdc4911bc3b /erts/include/internal/pthread/ethr_event.h
parent99e34bba1a60b262e24496cc9288b549360c6377 (diff)
downloadotp-b297bfdd47b0a39831d8cc2541aeb910f9af0bca.tar.gz
otp-b297bfdd47b0a39831d8cc2541aeb910f9af0bca.tar.bz2
otp-b297bfdd47b0a39831d8cc2541aeb910f9af0bca.zip
Introduce ethr_sint_t and use it for atomics
The atomic memory operations interface used the 'long' type and assumed that it was of the same size as 'void *'. This is true on most platforms, however, not on Windows 64.
Diffstat (limited to 'erts/include/internal/pthread/ethr_event.h')
-rw-r--r--erts/include/internal/pthread/ethr_event.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/erts/include/internal/pthread/ethr_event.h b/erts/include/internal/pthread/ethr_event.h
index 104ec287e0..4cf87406d7 100644
--- a/erts/include/internal/pthread/ethr_event.h
+++ b/erts/include/internal/pthread/ethr_event.h
@@ -40,15 +40,15 @@
#if ETHR_SIZEOF_PTR == 8
-#define ETHR_EVENT_OFF_WAITER__ 0xffffffffffffffffL
-#define ETHR_EVENT_OFF__ 0x7777777777777777L
-#define ETHR_EVENT_ON__ 0L
+#define ETHR_EVENT_OFF_WAITER__ ((ethr_sint_t) 0xffffffffffffffffL)
+#define ETHR_EVENT_OFF__ ((ethr_sint_t) 0x7777777777777777L)
+#define ETHR_EVENT_ON__ ((ethr_sint_t) 0L)
#elif ETHR_SIZEOF_PTR == 4
-#define ETHR_EVENT_OFF_WAITER__ 0xffffffffL
-#define ETHR_EVENT_OFF__ 0x77777777L
-#define ETHR_EVENT_ON__ 0L
+#define ETHR_EVENT_OFF_WAITER__ ((ethr_sint_t) 0xffffffffL)
+#define ETHR_EVENT_OFF__ ((ethr_sint_t) 0x77777777L)
+#define ETHR_EVENT_ON__ ((ethr_sint_t) 0L)
#else
@@ -77,7 +77,7 @@ typedef struct {
static void ETHR_INLINE
ETHR_INLINE_FUNC_NAME_(ethr_event_set)(ethr_event *e)
{
- long val;
+ ethr_sint_t val;
ETHR_WRITE_MEMORY_BARRIER;
val = ethr_atomic_xchg(&e->futex, ETHR_EVENT_ON__);
if (val == ETHR_EVENT_OFF_WAITER__) {
@@ -114,7 +114,7 @@ typedef struct {
static void ETHR_INLINE
ETHR_INLINE_FUNC_NAME_(ethr_event_set)(ethr_event *e)
{
- long val;
+ ethr_sint_t val;
ETHR_WRITE_MEMORY_BARRIER;
val = ethr_atomic_xchg(&e->state, ETHR_EVENT_ON__);
if (val == ETHR_EVENT_OFF_WAITER__) {