From b297bfdd47b0a39831d8cc2541aeb910f9af0bca Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Fri, 3 Dec 2010 10:57:26 +0100 Subject: 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. --- erts/include/internal/pthread/ethr_event.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'erts/include/internal/pthread/ethr_event.h') 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__) { -- cgit v1.2.3