mirror of https://github.com/mkerrisk/man-pages
circleq.3: Add remaining details to complete the page
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
086acf39f1
commit
ccb0db7f35
|
@ -49,6 +49,7 @@ CIRCLEQ_LOOP_PREV,
|
||||||
CIRCLEQ_NEXT,
|
CIRCLEQ_NEXT,
|
||||||
CIRCLEQ_PREV,
|
CIRCLEQ_PREV,
|
||||||
CIRCLEQ_REMOVE
|
CIRCLEQ_REMOVE
|
||||||
|
\- implementation of a double-linked circular queue
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
.B #include <sys/queue.h>
|
.B #include <sys/queue.h>
|
||||||
|
@ -96,6 +97,8 @@ CIRCLEQ_REMOVE
|
||||||
.PP
|
.PP
|
||||||
.BI "void CIRCLEQ_REMOVE(CIRCLEQ_HEAD *" head ", TYPE *" elm ", CIRCLEQ_ENTRY " NAME ");"
|
.BI "void CIRCLEQ_REMOVE(CIRCLEQ_HEAD *" head ", TYPE *" elm ", CIRCLEQ_ENTRY " NAME ");"
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
These macros define and operate on doubly-linked circular queues.
|
||||||
|
.PP
|
||||||
In the macro definitions,
|
In the macro definitions,
|
||||||
.I TYPE
|
.I TYPE
|
||||||
is the name of a user-defined structure,
|
is the name of a user-defined structure,
|
||||||
|
@ -252,11 +255,44 @@ removes the element
|
||||||
.I elm
|
.I elm
|
||||||
from the circular queue.
|
from the circular queue.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
.BR CIRCLEQ_EMPTY ()
|
||||||
|
returns nonzero if the queue is empty,
|
||||||
|
and zero if the queue contains at least one entry.
|
||||||
|
.PP
|
||||||
|
.BR CIRCLEQ_FIRST (),
|
||||||
|
.BR CIRCLEQ_LAST (),
|
||||||
|
.BR CIRCLEQ_NEXT (),
|
||||||
|
and
|
||||||
|
.BR CIRCLEQ_PREV ()
|
||||||
|
return a pointer to the first, last, next or previous
|
||||||
|
.I CIRCLEQ_ENTRY
|
||||||
|
structure, respectively.
|
||||||
|
.PP
|
||||||
|
.BR CIRCLEQ_HEAD_INITIALIZER ()
|
||||||
|
returns an initializer that can be assigned to the queue
|
||||||
|
.IR head .
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008.
|
Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008.
|
||||||
Present on the BSDs
|
Present on the BSDs
|
||||||
(CIRCLEQ macros first appeared in 4.4BSD).
|
(CIRCLEQ macros first appeared in 4.4BSD).
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
|
The macros
|
||||||
|
.BR CIRCLEQ_FOREACH ()
|
||||||
|
and
|
||||||
|
.BR CIRCLEQ_FOREACH_REVERSE ()
|
||||||
|
don't allow
|
||||||
|
.I var
|
||||||
|
to be removed or freed within the loop,
|
||||||
|
as it would interfere with the traversal.
|
||||||
|
The macros
|
||||||
|
.BR CIRCLEQ_FOREACH_SAFE ()
|
||||||
|
and
|
||||||
|
.BR CIRCLEQ_FOREACH_REVERSE_SAFE (),
|
||||||
|
which are present on the BSDs but are not present in glibc,
|
||||||
|
fix this limitation by allowing
|
||||||
|
.I var
|
||||||
|
to safely be removed from the list and freed from within the loop
|
||||||
|
without interfering with the traversal.
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.EX
|
.EX
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
@ -314,3 +350,5 @@ main(void)
|
||||||
}
|
}
|
||||||
.EE
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
|
.BR insque (3),
|
||||||
|
.BR queue (3)
|
||||||
|
|
Loading…
Reference in New Issue