diff options
author | Rickard Green <[email protected]> | 2013-02-21 22:44:54 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2013-02-21 22:44:54 +0100 |
commit | a38e30874b799c99ff3ac6de7b4c60456449d244 (patch) | |
tree | 138ac747e41f9b211bb7679154b51bdcd615a810 /erts/emulator/beam/erl_thr_queue.h | |
parent | df4ab03bd97944088e85dbc4df5b31cde50f0bb9 (diff) | |
parent | c53b24bcbcbfa55f6c1b8a1e568b99e9874d0d61 (diff) | |
download | otp-a38e30874b799c99ff3ac6de7b4c60456449d244.tar.gz otp-a38e30874b799c99ff3ac6de7b4c60456449d244.tar.bz2 otp-a38e30874b799c99ff3ac6de7b4c60456449d244.zip |
Merge branch 'rickard/r16b/thread-queue-fix/OTP-10854'
* rickard/r16b/thread-queue-fix/OTP-10854:
Fix lost enqueue notification
Use dirty read instead of union which can be unsafe on some platforms
Add atomic dirty read and dirty set operations
Diffstat (limited to 'erts/emulator/beam/erl_thr_queue.h')
-rw-r--r-- | erts/emulator/beam/erl_thr_queue.h | 13 |
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; |