[PATCH] tsearch.3: Document twalk_r function added in glibc 2.30

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 man3/tsearch.3 | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/man3/tsearch.3 b/man3/tsearch.3
index b64c9c6b7..c832b7009 100644
--- a/man3/tsearch.3
+++ b/man3/tsearch.3
@@ -40,6 +40,10 @@ tsearch, tfind, tdelete, twalk, tdestroy \- manage a binary search tree
 .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>
@@ -151,6 +155,16 @@ Thus, the choice of name
 .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 ,
@@ -191,6 +205,9 @@ also
 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).
@@ -209,14 +226,19 @@ T{
 .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
-- 
2.20.1




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux