.PP
.BI "void twalk(const void *" root ", void (*" action ")(const void *" nodep ,
.BI " VISIT " which ", int " depth "));"
+.PP
+.BI "void twalk_r(const void *" root ", void (*" action ")(const void *" np ,
+.BI " VISIT " which ", void *" closure "),
+.BI " void *" closure);"
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <search.h>
.B post\%order
is rather confusing.)
.PP
+.BR twalk_r ()
+is similar to
+.BR twalk (),
+but instead of the leval argument, the
+.I closure
+argument pointer is passed to each invocation of the action callback,
+unchanged. This pointer can be used to pass information to and from
+to the callback function in a thread-safe fashion, without resorting
+to global variables.
+.PP
.BR tdestroy ()
removes the whole tree pointed to by
.IR root ,
return NULL if
.I rootp
was NULL on entry.
+.SH VERSIONS
+.BR twalk_r ()
+is available since glibc 2.30.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.BR twalk ()
T} Thread safety MT-Safe race:root
T{
+.BR twalk_r ()
+T} Thread safety MT-Safe race:root
+T{
.BR tdestroy ()
T} Thread safety MT-Safe
.TE
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4.
-The function
+The functions
.BR tdestroy ()
-is a GNU extension.
+and
+.BR twalk_r ()
+are GNU extensions.
.SH NOTES
.BR twalk ()
takes a pointer to the root, while the other functions