aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_thr_queue.h
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2013-02-18 00:29:51 +0100
committerRickard Green <[email protected]>2013-02-21 01:08:09 +0100
commitdf40b0b99810121d9630730d6f58cf96bfea70e8 (patch)
tree33b715adbfe2522b45a98c92e939d9b1b879ea5f /erts/emulator/beam/erl_thr_queue.h
parent4f6a7255afbd5b296139e073d66564976d80cc06 (diff)
downloadotp-df40b0b99810121d9630730d6f58cf96bfea70e8.tar.gz
otp-df40b0b99810121d9630730d6f58cf96bfea70e8.tar.bz2
otp-df40b0b99810121d9630730d6f58cf96bfea70e8.zip
Use dirty read instead of union which can be unsafe on some platforms
Diffstat (limited to 'erts/emulator/beam/erl_thr_queue.h')
-rw-r--r--erts/emulator/beam/erl_thr_queue.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/erts/emulator/beam/erl_thr_queue.h b/erts/emulator/beam/erl_thr_queue.h
index edcf2c3823..ae8c7fb19a 100644
--- a/erts/emulator/beam/erl_thr_queue.h
+++ b/erts/emulator/beam/erl_thr_queue.h
@@ -76,13 +76,12 @@ typedef struct {
typedef struct ErtsThrQElement_t_ ErtsThrQElement_t;
typedef struct ErtsThrQElement_t ErtsThrQPrepEnQ_t;
-typedef union {
- erts_atomic_t atmc;
- ErtsThrQElement_t *ptr;
-} ErtsThrQPtr_t;
-
struct ErtsThrQElement_t_ {
- ErtsThrQPtr_t next;
+#ifdef USE_THREADS
+ erts_atomic_t next;
+#else
+ ErtsThrQElement_t *next;
+#endif
union {
erts_atomic_t atmc;
void *ptr;
@@ -130,7 +129,7 @@ struct ErtsThrQ_t_ {
* thread dequeuing.
*/
struct {
- ErtsThrQPtr_t head;
+ erts_atomic_t head;
ErtsThrQLive_t live;
ErtsThrQElement_t *first;
ErtsThrQElement_t *unref_end;