summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPeter Maydell2015-03-13 10:54:23 +0100
committerPeter Maydell2015-03-13 10:54:23 +0100
commitf9f141b7475acfed1b6a28809687109702295be3 (patch)
treeb8885cb668b93775edddf18682e8f89d33d3bf72 /include
parentMerge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20150312-1' into s... (diff)
parentqcow2: fix the macro QCOW_MAX_L1_SIZE's use (diff)
downloadqemu-f9f141b7475acfed1b6a28809687109702295be3.tar.gz
qemu-f9f141b7475acfed1b6a28809687109702295be3.tar.xz
qemu-f9f141b7475acfed1b6a28809687109702295be3.zip
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
# gpg: Signature made Thu Mar 12 19:09:26 2015 GMT using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/block-pull-request: qcow2: fix the macro QCOW_MAX_L1_SIZE's use queue: fix QSLIST_INSERT_HEAD_ATOMIC race Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/queue.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index 80941506ce..f781aa20a8 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -197,11 +197,12 @@ struct { \
(head)->slh_first = (elm); \
} while (/*CONSTCOND*/0)
-#define QSLIST_INSERT_HEAD_ATOMIC(head, elm, field) do { \
- do { \
- (elm)->field.sle_next = (head)->slh_first; \
- } while (atomic_cmpxchg(&(head)->slh_first, (elm)->field.sle_next, \
- (elm)) != (elm)->field.sle_next); \
+#define QSLIST_INSERT_HEAD_ATOMIC(head, elm, field) do { \
+ typeof(elm) save_sle_next; \
+ do { \
+ save_sle_next = (elm)->field.sle_next = (head)->slh_first; \
+ } while (atomic_cmpxchg(&(head)->slh_first, save_sle_next, (elm)) != \
+ save_sle_next); \
} while (/*CONSTCOND*/0)
#define QSLIST_MOVE_ATOMIC(dest, src) do { \