summaryrefslogtreecommitdiffstats
path: root/sys/sys/queue.h
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2015-11-19 13:38:07 +0000
committermillert <millert@openbsd.org>2015-11-19 13:38:07 +0000
commit44ab62a3fbea0b0abc263b9c90c1e0881a16f115 (patch)
tree8a4b2002fbe7b90813f0bc6d1539b178c36e6060 /sys/sys/queue.h
parentdont try and wakeup other threads to handle pending work when we (diff)
downloadwireguard-openbsd-44ab62a3fbea0b0abc263b9c90c1e0881a16f115.tar.xz
wireguard-openbsd-44ab62a3fbea0b0abc263b9c90c1e0881a16f115.zip
Add SIMPLEQ_CONCAT and TAILQ_CONCAT for moving one queue onto the end
of another one. Adapted from FreeBSD. OK jmc@ dlg@ nicm@
Diffstat (limited to 'sys/sys/queue.h')
-rw-r--r--sys/sys/queue.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/sys/queue.h b/sys/sys/queue.h
index eb5bb0279d1..02cbd4de655 100644
--- a/sys/sys/queue.h
+++ b/sys/sys/queue.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue.h,v 1.40 2015/10/30 12:20:56 jasper Exp $ */
+/* $OpenBSD: queue.h,v 1.41 2015/11/19 13:38:07 millert Exp $ */
/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
/*
@@ -316,6 +316,14 @@ struct { \
(head)->sqh_last = &(elm)->field.sqe_next; \
} while (0)
+#define SIMPLEQ_CONCAT(head1, head2) do { \
+ if (!SIMPLEQ_EMPTY((head2))) { \
+ *(head1)->sqh_last = (head2)->sqh_first; \
+ (head1)->sqh_last = (head2)->sqh_last; \
+ SIMPLEQ_INIT((head2)); \
+ } \
+} while (0)
+
/*
* XOR Simple queue definitions.
*/
@@ -516,6 +524,15 @@ struct { \
_Q_INVALIDATE((elm)->field.tqe_next); \
} while (0)
+#define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
+ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
+ (head1)->tqh_last = (head2)->tqh_last; \
+ TAILQ_INIT((head2)); \
+ } \
+} while (0)
+
/*
* Circular queue definitions.
*/